pmac-utils/ 40755 5313 5313 0 6555112725 11220 5ustar heesheespmac-utils/sndvolmix.c100644 5313 5313 6414 6430066164 13506 0ustar heeshees#include #include #include #include #include #include #include "awacs_defs.h" static inline void eieio( void ) { asm volatile("eieio" : :); } static inline unsigned ld_rev(volatile unsigned *addr) { unsigned val; asm volatile("lwbrx %0,0,%1" : "=r" (val) : "r" (addr)); return val; } static inline void st_rev(volatile unsigned *addr, unsigned val) { asm volatile("stwbrx %0,0,%1" : : "r" (val), "r" (addr) : "memory"); } unsigned *awacs; static inline void busy_wait( void ) { eieio(); while ((ld_rev(&awacs[4]) & 0x1000000) != 0) ; } int main(int ac, char **av) { int fd, i; int l, r; int hflag = 0, aflag = 0, cflag = 1, mflag = 0, testflag = 0; int mux_mask = MASK_ADDR_MUX; while ((i = getopt(ac, av, "hacmt")) != -1) { switch (i) { case 'h': hflag = 1; break; case 'a': aflag = 1; mux_mask |= MASK_MUX_AUDIN; break; case 'c': cflag = 1; mux_mask |= MASK_MUX_CD; break; case 'm': mflag = 1; mux_mask |= MASK_MUX_MIC; break; case 't': aflag = cflag = mflag = 0; testflag = 1; break; default: (void) fprintf(stderr, "Usage: %s [-hacm] [vol | lvol rvol]\n", av[0]); (void) fprintf(stderr, "\t-h mute headphones\n"); (void) fprintf(stderr, "\t-a activate Audio In playthrough\n"); (void) fprintf(stderr, "\t-c activate Cdrom playthrough\n"); (void) fprintf(stderr, "\t-m activate Microphone playthrough\n"); (void) fprintf(stderr, "\tvol Master Volume\n"); (void) fprintf(stderr, "\tlvol Left Master Volume\n"); (void) fprintf(stderr, "\trvol Right Master Volume\n"); exit(EXIT_FAILURE); } } if ((fd = open("/dev/mem", O_RDWR)) < 0) { perror("/dev/mem"); exit(EXIT_FAILURE); } awacs = (unsigned *) mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (int) AUD_CONT); if ((long)awacs == -1) { perror("mmap"); exit(EXIT_FAILURE); } mux_mask |= GAINRIGHT(4) | GAINLEFT(4); st_rev(&awacs[4], mux_mask); busy_wait(); st_rev(&awacs[4], mux_mask | MASK_GAINLINE); busy_wait(); st_rev(&awacs[4], (hflag? MASK_HDMUTE: 0) | MASK_ADDR1 | MASK_LOOPTHRU | MASK_PAROUT); busy_wait(); if (optind < ac) { l = r = atoi(av[optind]) & 0xf; if (optind + 1 < ac) r = atoi(av[optind+1]) & 0xf; if (l == 0 && r == 0) { st_rev(&awacs[4], MASK_ADDR1 | MASK_HDMUTE | MASK_SPKMUTE | MASK_LOOPTHRU | MASK_RECALIBRATE); /* mute the output */ busy_wait(); } else { st_rev(&awacs[4], MASK_ADDR_VOLSPK | VOLLEFT(l) | VOLRIGHT(r)); busy_wait(); st_rev(&awacs[4], MASK_ADDR_VOLHD | VOLLEFT(l) | VOLRIGHT(r)); busy_wait(); } } exit(EXIT_SUCCESS); } pmac-utils/clock.c100644 5313 5313 31116 6504151510 12563 0ustar heeshees#include #include #include #include #include #include #include #include #include #include /* * Adapted for Power Macintosh by Paul Mackerras. */ /* V1.0 * CMOS clock manipulation - Charles Hedrick, hedrick@cs.rutgers.edu, Apr 1992 * * clock [-u] -r - read cmos clock * clock [-u] -w - write cmos clock from system time * clock [-u] -s - set system time from cmos clock * clock [-u] -a - set system time from cmos clock, adjust the time to * correct for systematic error, and put it back to the cmos. * -u indicates cmos clock is kept in universal time * * The program is designed to run setuid, since we need to be able to * write to the CUDA. * ********************* * V1.1 * Modified for clock adjustments - Rob Hooft, hooft@chem.ruu.nl, Nov 1992 * Also moved error messages to stderr. The program now uses getopt. * Changed some exit codes. Made 'gcc 2.3 -Wall' happy. * * I think a small explanation of the adjustment routine should be given * here. The problem with my machine is that its CMOS clock is 10 seconds * per day slow. With this version of clock.c, and my '/etc/rc.local' * reading '/etc/clock -au' instead of '/etc/clock -u -s', this error * is automatically corrected at every boot. * * To do this job, the program reads and writes the file '/etc/adjtime' * to determine the correction, and to save its data. In this file are * three numbers: * * 1) the correction in seconds per day (So if your clock runs 5 * seconds per day fast, the first number should read -5.0) * 2) the number of seconds since 1/1/1970 the last time the program was * used. * 3) the remaining part of a second which was leftover after the last * adjustment * * Installation and use of this program: * * a) create a file '/etc/adjtime' containing as the first and only line: * '0.0 0 0.0' * b) run 'clock -au' or 'clock -a', depending on whether your cmos is in * universal or local time. This updates the second number. * c) set your system time using the 'date' command. * d) update your cmos time using 'clock -wu' or 'clock -w' * e) replace the first number in /etc/adjtime by your correction. * f) put the command 'clock -au' or 'clock -a' in your '/etc/rc.local' * * If the adjustment doesn't work for you, try contacting me by E-mail. * ****** * V1.2 * * Applied patches by Harald Koenig (koenig@nova.tat.physik.uni-tuebingen.de) * Patched and indented by Rob Hooft (hooft@EMBL-Heidelberg.DE) * * A free quote from a MAIL-message (with spelling corrections): * * "I found the explanation and solution for the CMOS reading 0xff problem * in the 0.99pl13c (ALPHA) kernel: the RTC goes offline for a small amount * of time for updating. Solution is included in the kernel source * (linux/kernel/time.c)." * * "I modified clock.c to fix this problem and added an option (now default, * look for USE_INLINE_ASM_IO) that I/O instructions are used as inline * code and not via /dev/port (still possible via #undef ...)." * * With the new code, which is partially taken from the kernel sources, * the CMOS clock handling looks much more "official". * Thanks Harald (and Torsten for the kernel code)! * ****** * V1.3 * Canges from alan@spri.levels.unisa.edu.au (Alan Modra): * a) Fix a few typos in comments and remove reference to making * clock -u a cron job. The kernel adjusts cmos time every 11 * minutes - see kernel/sched.c and kernel/time.c set_rtc_mmss(). * This means we should really have a cron job updating * /etc/adjtime every 11 mins (set last_time to the current time * and not_adjusted to ???). * b) Swapped arguments of outb() to agree with asm/io.h macro of the * same name. Use outb() from asm/io.h as it's slightly better. * c) Changed CMOS_READ and CMOS_WRITE to inline functions. Inserted * cli()..sti() pairs in appropriate places to prevent possible * errors, and changed ioperm() call to iopl() to allow cli. * d) Moved some variables around to localise them a bit. * e) Fixed bug with clock -ua or clock -us that cleared environment * variable TZ. This fix also cured the annoying display of bogus * day of week on a number of machines. (Use mktime(), ctime() * rather than asctime() ) * f) Use settimeofday() rather than stime(). This one is important * as it sets the kernel's timezone offset, which is returned by * gettimeofday(), and used for display of MSDOS and OS2 file * times. * g) faith@cs.unc.edu added -D flag for debugging * * V1.4: alan@SPRI.Levels.UniSA.Edu.Au (Alan Modra) * Wed Feb 8 12:29:08 1995, fix for years > 2000. * faith@cs.unc.edu added -v option to print version. * * August 1996 Tom Dyas (tdyas@eden.rutgers.edu) * Converted to be compatible with the SPARC /dev/rtc driver. * */ #define VERSION "1.4" /* Here the information for time adjustments is kept. */ #define ADJPATH "/etc/adjtime" /* Apparently the RTC on PowerMacs stores seconds since 1 Jan 1904 */ #define RTC_OFFSET 2082844800 /* used for debugging the code. */ /*#define KEEP_OFF */ /* Globals */ int readit = 0; int adjustit = 0; int writeit = 0; int setit = 0; int universal = 0; int debug = 0; time_t mkgmtime(struct tm *); volatile void usage ( void ) { (void) fprintf (stderr, "clock [-u] -r|w|s|a|v\n" " r: read and print CMOS clock\n" " w: write CMOS clock from system time\n" " s: set system time from CMOS clock\n" " a: get system time and adjust CMOS clock\n" " u: CMOS clock is in universal time\n" " v: print version (" VERSION ") and exit\n" ); exit(EXIT_FAILURE); } int adb_fd; void adb_init ( void ) { adb_fd = open ("/dev/adb", 2); if (adb_fd < 0) { perror ("unable to open /dev/adb read/write : "); exit(EXIT_FAILURE); } } unsigned char get_packet[2] = { (unsigned char) CUDA_PACKET, (unsigned char) CUDA_GET_TIME }; unsigned char set_packet[6] = { (unsigned char) CUDA_PACKET, (unsigned char) CUDA_SET_TIME }; int main (int argc, char **argv ) { struct tm tm, *tmp; time_t systime; time_t last_time; time_t clock_time; int i, arg; double factor; double not_adjusted; int adjustment = 0; /* unsigned char save_control, save_freq_select; */ unsigned char reply[16]; while ((arg = getopt (argc, argv, "rwsuaDv")) != -1) { switch (arg) { case 'r': readit = 1; break; case 'w': writeit = 1; break; case 's': setit = 1; break; case 'u': universal = 1; break; case 'a': adjustit = 1; break; case 'D': debug = 1; break; case 'v': (void) fprintf( stderr, "clock " VERSION "\n" ); exit(EXIT_SUCCESS); default: usage (); } } /* If we are in MkLinux do not even bother trying to set the clock */ if(!access("/proc/osfmach3/version", R_OK)) { // We're running MkLinux if ( readit | writeit | setit | adjustit ) printf("You must change the clock setting in MacOS.\n"); exit(0); } if (readit + writeit + setit + adjustit > 1) usage (); /* only allow one of these */ if (!(readit | writeit | setit | adjustit)) /* default to read */ readit = 1; adb_init (); if (adjustit) { /* Read adjustment parameters first */ FILE *adj; if ((adj = fopen (ADJPATH, "r")) == NULL) { perror (ADJPATH); exit(EXIT_FAILURE); } if (fscanf (adj, "%lf %d %lf", &factor, (int *) (&last_time), ¬_adjusted) < 0) { perror (ADJPATH); exit(EXIT_FAILURE); } (void) fclose (adj); if (debug) (void) printf( "Last adjustment done at %d seconds after 1/1/1970\n", (int) last_time); } if (readit || setit || adjustit) { int ii; if (write(adb_fd, get_packet, sizeof(get_packet)) < 0) { perror("write adb"); exit(EXIT_FAILURE); } ii = (int) read(adb_fd, reply, sizeof(reply)); if (ii < 0) { perror("read adb"); exit(EXIT_FAILURE); } if (ii != 7) (void) fprintf(stderr, "Warning: bad reply length from CUDA (%d)\n", ii); clock_time = (time_t) ((reply[3] << 24) + (reply[4] << 16) + (reply[5] << 8)) + (time_t) reply[6]; clock_time -= RTC_OFFSET; if (universal) { systime = clock_time; } else { tm = *gmtime(&clock_time); (void) printf("time in rtc is %s", asctime(&tm)); tm.tm_isdst = -1; /* don't know whether it's DST */ systime = mktime(&tm); } } if (readit) { (void) printf ("%s", ctime (&systime )); } if (setit || adjustit) { struct timeval tv; struct timezone tz; /* program is designed to run setuid, be secure! */ if (getuid () != 0) { (void) fprintf (stderr, "Sorry, must be root to set or adjust time\n"); exit(EXIT_FAILURE); } if (adjustit) { /* the actual adjustment */ double exact_adjustment; exact_adjustment = ((double) (systime - last_time)) * factor / (24 * 60 * 60) + not_adjusted; if (exact_adjustment > 0.) adjustment = (int) (exact_adjustment + 0.5); else adjustment = (int) (exact_adjustment - 0.5); not_adjusted = exact_adjustment - (double) adjustment; systime += adjustment; if (debug) { (void) printf ("Time since last adjustment is %d seconds\n", (int) (systime - last_time)); (void) printf ("Adjusting time by %d seconds\n", adjustment); (void) printf ("remaining adjustment is %.3f seconds\n", not_adjusted); } } #ifndef KEEP_OFF tv.tv_sec = systime; tv.tv_usec = 0; tz.tz_minuteswest = timezone / 60; tz.tz_dsttime = daylight; if (settimeofday (&tv, &tz) != 0) { (void) fprintf (stderr, "Unable to set time -- probably you are not root\n"); exit(EXIT_FAILURE); } if (debug) { (void) printf( "Called settimeofday:\n" ); (void) printf( "\ttv.tv_sec = %ld, tv.tv_usec = %ld\n", tv.tv_sec, tv.tv_usec ); (void) printf( "\ttz.tz_minuteswest = %d, tz.tz_dsttime = %d\n", tz.tz_minuteswest, tz.tz_dsttime ); } #endif } if (writeit || (adjustit && adjustment != 0)) { systime = time (NULL); if (universal) { clock_time = systime; } else { tmp = localtime(&systime); clock_time = mkgmtime(tmp); } clock_time += RTC_OFFSET; set_packet[2] = clock_time >> 24; set_packet[3] = clock_time >> 16; set_packet[4] = clock_time >> 8; set_packet[5] = (unsigned char) clock_time; if (write(adb_fd, set_packet, sizeof(set_packet)) < 0) { perror("write adb (set)"); exit(EXIT_FAILURE); } i = (int) read(adb_fd, reply, sizeof(reply)); if (debug) { int j; (void) printf("set reply %d bytes:", i); for (j = 0; j < i; ++j) (void) printf(" %.2x", (unsigned int) reply[j]); (void) printf("\n"); } if (i != 3 || reply[1] != (unsigned char) 0) (void) fprintf(stderr, "Warning: error %d setting RTC\n", (int) reply[1]); if (debug) { clock_time -= RTC_OFFSET; (void) printf("set RTC to %s", asctime(gmtime(&clock_time))); } } else if (debug) (void) printf ("CMOS clock unchanged.\n"); /* Save data for next 'adjustit' call */ if (adjustit) { FILE *adj; if ((adj = fopen (ADJPATH, "w")) == NULL) { perror (ADJPATH); exit(EXIT_FAILURE); } (void) fprintf (adj, "%f %d %f\n", factor, (int) systime, not_adjusted); (void) fclose (adj); } exit(EXIT_SUCCESS); } /* Stolen from linux/arch/i386/kernel/time.c. */ /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. * * [For the Julian calendar (which was used in Russia before 1917, * Britain & colonies before 1752, anywhere else before 1582, * and is still in use by some communities) leave out the * -year/100+year/400 terms, and add 10.] * * This algorithm was first published by Gauss (I think). * * WARNING: this function will overflow on 2106-02-07 06:28:16 on * machines were long is 32-bit! (However, as time_t is signed, we * will already get problems at other places on 2038-01-19 03:14:08) */ time_t mkgmtime(struct tm *tm) { int mon = tm->tm_mon + 1; int year = tm->tm_year + 1900; if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ mon += 12; /* Puts Feb last since it has leap day */ year -= 1; } return ((( (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12) + tm->tm_mday + year*365 - 719499 )*24 + tm->tm_hour /* now have hours */ )*60 + tm->tm_min /* now have minutes */ )*60 + tm->tm_sec; /* finally seconds */ } pmac-utils/fdeject.c100644 5313 5313 1067 6325365117 13071 0ustar heeshees#include #include #include #include #include #include int main(int ac, char **av) { char *dev; int fd; if (ac > 2) { (void) fprintf(stderr, "Usage: %s [device]\n", av[0]); exit(EXIT_FAILURE); } dev = ac > 1? av[1]: "/dev/fd0"; fd = open(dev, O_RDONLY | O_NDELAY); if (fd < 0) { perror(dev); exit(EXIT_FAILURE); } if (ioctl(fd, FDEJECT, NULL) < 0) { perror("floppy eject ioctl"); exit(EXIT_FAILURE); } (void) close(fd); exit(EXIT_SUCCESS); } pmac-utils/nvsetenv.c100644 5313 5313 14051 6331123041 13333 0ustar heeshees#include #include #include #include #include #define NVSTART 0x1800 #define NVSIZE 0x800 #define MXSTRING 128 #define N_NVVARS (int)(sizeof(nvvars) / sizeof(nvvars[0])) static int nvfd, nvstr_used; static char nvstrbuf[NVSIZE]; struct nvram { unsigned short magic; /* 0x1275 */ unsigned char char2; unsigned char char3; unsigned short cksum; unsigned short end_vals; unsigned short start_strs; unsigned short word5; unsigned long bits; unsigned long vals[1]; }; union { struct nvram nv; char c[NVSIZE]; unsigned short s[NVSIZE/2]; } nvbuf; enum nvtype { boolean, word, string }; struct nvvar { const char *name; enum nvtype type; } nvvars[] = { {"little-endian?", boolean}, {"real-mode?", boolean}, {"auto-boot?", boolean}, {"diag-switch?", boolean}, {"fcode-debug?", boolean}, {"oem-banner?", boolean}, {"oem-logo?", boolean}, {"use-nvramrc?", boolean}, {"real-base", word}, {"real-size", word}, {"virt-base", word}, {"virt-size", word}, {"load-base", word}, {"pci-probe-list", word}, {"screen-#columns", word}, {"screen-#rows", word}, {"selftest-#megs", word}, {"boot-device", string}, {"boot-file", string}, {"diag-device", string}, {"diag-file", string}, {"input-device", string}, {"output-device", string}, {"oem-banner", string}, {"oem-logo", string}, {"nvramrc", string}, {"boot-command", string}, }; union nvval { unsigned long word_val; char *str_val; } nvvals[32]; int nvcsum( void ) { int i; unsigned c; c = 0; for (i = 0; i < NVSIZE/2; ++i) c += nvbuf.s[i]; c = (c & 0xffff) + (c >> 16); c += (c >> 16); return c & 0xffff; } void nvload( void ) { int s; if (lseek(nvfd, NVSTART, 0) < 0 || read(nvfd, &nvbuf, NVSIZE) != NVSIZE) { perror("Error reading /dev/nvram"); exit(EXIT_FAILURE); } s = nvcsum(); if (s != 0xffff) (void) fprintf(stderr, "Warning: checksum error (%x) on nvram\n", s ^ 0xffff); } void nvstore(void) { if (lseek(nvfd, NVSTART, 0) < 0 || write(nvfd, &nvbuf, NVSIZE) != NVSIZE) { perror("Error writing /dev/nvram"); exit(EXIT_FAILURE); } } void nvunpack( void ) { int i; unsigned long bmask; int vi, off, len; nvstr_used = 0; bmask = 0x80000000; vi = 0; for (i = 0; i < N_NVVARS; ++i) { switch (nvvars[i].type) { case boolean: nvvals[i].word_val = (nvbuf.nv.bits & bmask) ? 1 : 0; bmask >>= 1; break; case word: nvvals[i].word_val = nvbuf.nv.vals[vi++]; break; case string: off = nvbuf.nv.vals[vi] >> 16; len = nvbuf.nv.vals[vi++] & 0xffff; nvvals[i].str_val = nvstrbuf + nvstr_used; memcpy(nvvals[i].str_val, nvbuf.c + off - NVSTART, (size_t) len); nvvals[i].str_val[len] = (char) 0; nvstr_used += len + 1; break; } } } void nvpack( void ) { int i, vi; size_t off, len; unsigned long bmask; bmask = 0x80000000; vi = 0; off = NVSIZE; nvbuf.nv.bits = 0; for (i = 0; i < N_NVVARS; ++i) { switch (nvvars[i].type) { case boolean: if (nvvals[i].word_val != 0) nvbuf.nv.bits |= bmask; bmask >>= 1; break; case word: nvbuf.nv.vals[vi++] = nvvals[i].word_val; break; case string: len = strlen(nvvals[i].str_val); off -= len; memcpy(nvbuf.c + off, nvvals[i].str_val, len); nvbuf.nv.vals[vi++] = ((off + NVSTART) << 16) + len; break; } } nvbuf.nv.magic = 0x1275; nvbuf.nv.cksum = 0; nvbuf.nv.end_vals = NVSTART + (unsigned) &nvbuf.nv.vals[vi] - (unsigned) &nvbuf; nvbuf.nv.start_strs = (unsigned short int) (off + NVSTART); memset(&nvbuf.c[nvbuf.nv.end_vals - NVSTART], 0, (size_t) (nvbuf.nv.start_strs - nvbuf.nv.end_vals) ); nvbuf.nv.cksum = (unsigned short int) (~nvcsum()); } void print_var(int i, int indent) { char *p; switch (nvvars[i].type) { case boolean: (void) printf("%s", nvvals[i].word_val != 0 ? "true": "false"); break; case word: (void) printf("0x%lx", nvvals[i].word_val); break; case string: for (p = nvvals[i].str_val; *p != (char) 0; ++p) if (*p != (char) '\r') (void) putchar(*p); else (void) printf("\n%*s", indent, ""); break; } (void) printf("\n"); } void parse_val(int i, char *str) { char *endp; switch (nvvars[i].type) { case boolean: if (strcmp(str, "true") == 0) nvvals[i].word_val = 1; else if (strcmp(str, "false") == 0) nvvals[i].word_val = 0; else { (void) fprintf(stderr, "bad boolean value '%s' for %s\n", str, nvvars[i].name); exit(EXIT_FAILURE); } break; case word: nvvals[i].word_val = strtoul(str, &endp, 16); if (str == endp) { (void) fprintf(stderr, "bad hexadecimal value '%s' for %s\n", str, nvvars[i].name); exit(EXIT_FAILURE); } break; case string: nvvals[i].str_val = str; break; } } int main(int ac, char **av) { int i = 0, l, print; l = (int) strlen(av[0]); print = (int) (ac <= 2 || (l > 8 && strcmp(&av[0][l-8], "printenv") == 0)); if (print != 0 && ac > 2) { (void) fprintf(stderr, "Usage: %s [variable]\n", av[0]); exit(EXIT_FAILURE); } if (ac > 3) { (void) fprintf(stderr, "Usage: %s [variable [value]]\n", av[0]); exit(EXIT_FAILURE); } if (ac >= 2) { for (i = 0; i < N_NVVARS; ++i) if (strcmp(av[1], nvvars[i].name) == 0) break; if (i >= N_NVVARS) { (void) fprintf(stderr, "%s: no variable called '%s'\n", av[1], av[1]); exit(EXIT_FAILURE); } } nvfd = open("/dev/nvram", ac <= 2 ? O_RDONLY: O_RDWR); if (nvfd < 0) { perror("Couldn't open /dev/nvram"); exit(EXIT_FAILURE); } nvload(); nvunpack(); switch (ac) { case 1: for (i = 0; i < N_NVVARS; ++i) { (void) printf("%-16s", nvvars[i].name); print_var(i, 16); } break; case 2: print_var(i, 0); break; case 3: parse_val(i, av[2]); nvpack(); nvstore(); break; } (void) close(nvfd); exit(EXIT_SUCCESS); } pmac-utils/nvvideo.c100644 5313 5313 3627 6325376604 13146 0ustar heeshees#include #include #include #include #include #define NVSTART 0x140f #define NVSIZE 0x2 unsigned char nvbuf[NVSIZE]; int nvfd; void nvload( void ) { if (lseek(nvfd, NVSTART, 0) < 0 || read(nvfd, &nvbuf, NVSIZE) != NVSIZE) { perror("Error reading /dev/nvram"); exit(EXIT_FAILURE); } } void nvstore( void ) { if (lseek(nvfd, NVSTART, 0) < 0 || write(nvfd, &nvbuf, NVSIZE) != NVSIZE) { perror("Error writing /dev/nvram"); exit(EXIT_FAILURE); } } struct nvvar { char *name; } nvvars[] = { {"video-mode"}, {"color-mode"}, }; #define N_NVVARS (int) (sizeof(nvvars) / sizeof(nvvars[0])) void print_var(int i, /*@unused@*/ int indent) { (void) printf("%d", (int) nvbuf[i]); (void) printf("\n"); } int main(int ac, char **av) { int i = 0; if (ac > 3 || (ac == 2 && (strcmp(av[1], "-?" ) == 0 || strcmp( av[1], "-h" ) == 0 || strcmp( av[1] , "--help" ) == 0)) ) { (void) fprintf(stderr, "Usage: %s [variable [value]]\n", av[0]); exit(EXIT_FAILURE); } if (ac >= 2) { for (i = 0; i < N_NVVARS; ++i) if (strcmp(av[1], nvvars[i].name) == 0) break; if (i >= N_NVVARS) { (void) fprintf(stderr, "%s: no variable called '%s'\n", av[1], av[1]); exit(EXIT_FAILURE); } } nvfd = open("/dev/nvram", ac <= 2? O_RDONLY: O_RDWR); if (nvfd < 0) { perror("Couldn't open /dev/nvram"); exit(EXIT_FAILURE); } nvload(); switch (ac) { case 1: for (i = 0; i < N_NVVARS; ++i) { (void) printf("%-16s", nvvars[i].name); print_var(i, 16); } break; case 2: print_var(i, 0); break; case 3: if (strcmp(av[1],nvvars[0].name)==0) nvbuf[0]=(unsigned char)strtoul(av[2], 0, 0); if (strcmp(av[1],nvvars[1].name)==0) nvbuf[1]=(unsigned char)strtoul(av[2], 0, 0); nvstore(); break; } (void) close(nvfd); exit(EXIT_SUCCESS); } pmac-utils/vmode.c100644 5313 5313 2034 6553575604 12601 0ustar heeshees#include #include #include #include #include #include #include int die(char *str) { perror(str); exit(EXIT_FAILURE); } int main(int ac, char **av) { struct vc_mode vc; struct vt_consize vt; if (ioctl(1, VC_GETMODE, &vc) < 0) (void) die("VC_GETMODE"); if (ac < 2) { (void) printf("%d %d\n", vc.mode, vc.depth); exit(EXIT_SUCCESS); } vc.mode = atoi(av[1]); if (ac > 2) vc.depth = atoi(av[2]); if (ioctl(1, VC_SETMODE, &vc) < 0) (void) die("VC_SETMODE"); if (ioctl(1, VC_GETMODE, &vc) < 0) (void) die("VC_GETMODE"); (void) memset(&vt, 0, sizeof(vt)); vt.v_vlin = (unsigned short int) vc.height; vt.v_rows = (unsigned short int) (vc.height / 16); vt.v_vcol = (unsigned short int) vc.width; vt.v_cols = (unsigned short int) (vc.width / 8); if (ioctl(1, VT_RESIZEX, &vt) < 0) (void) die("VT_RESIZEX"); (void) printf("\033[H\033[J"); (void) fflush(stdout); exit(EXIT_SUCCESS); } pmac-utils/.lclintrc100644 5313 5313 21 6325365202 13054 0ustar heeshees+standard -globs pmac-utils/Makefile100644 5313 5313 7160 6555113024 12752 0ustar heeshees# # Makefile Makefile for Powermac/Linux specific programs # Targets: all compiles everything # install installs the binaries # installdevs creates necessary devices # clean cleans up # # Version: @(#)Makefile 1.01 06-May-1997 Richard van Hees # prefix = exec_prefix = ${prefix} usr_prefix = ${prefix}/usr bindir = $(exec_prefix)/bin devsdir = ${prefix}/dev ubindir = $(usr_prefix)/bin sbindir = $(exec_prefix)/sbin usbindir = $(usr_prefix)/sbin mandir = $(usr_prefix)/man man1dir = $(usr_prefix)/man/man1 man8dir = $(usr_prefix)/man/man8 SGMLMAN = sgml2txt -man CC = gcc -Wall -Wstrict-prototypes CFLAGS = -O2 -fsigned-char LDFLAGS = -s INSTALL = /usr/bin/install -c SOUND_INC = -I. PROGS = clock fdeject mousemode nvsetenv nvvideo sndvolmix vmode SCRIPTS = macos # DEPENDENCIES: all: $(PROGS) $(SCRIPTS) clock: $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c fdeject: $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c mousemode: $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c nvsetenv: $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c nvvideo: $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c sndvolmix: $(CC) $(CFLAGS) $(SOUND_INC) $(LDFLAGS) -o $@ $@.c vmode: $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c man: $(SGMLMAN) clock.sgml $(SGMLMAN) fdeject.sgml $(SGMLMAN) mousemode.sgml $(SGMLMAN) nvsetenv.sgml $(SGMLMAN) nvvideo.sgml $(SGMLMAN) sndvolmix.sgml $(SGMLMAN) vmode.sgml $(SGMLMAN) macos.sgml installdirs: ./mkinstalldirs $(DESTDIR)$(sbindir) $(DESTDIR)$(ubindir) \ $(DESTDIR)$(man1dir) $(DESTDIR)$(man8dir) \ $(DESTDIR)$(usbindir) $(DESTDIR)$(devsdir) installdevs: @if [ ! -c $(DESTDIR)$(devsdir)/adb ]; then \ echo "Creating $(DESTDIR)$(devsdir)/adb ..."; \ mknod $(DESTDIR)$(devsdir)/adb c 56 0; \ chmod 600 $(DESTDIR)$(devsdir)/adb; \ fi @if [ ! -c $(DESTDIR)$(devsdir)/nvram ]; then \ echo "Creating $(DESTDIR)$(devsdir)/nvram ..."; \ mknod $(DESTDIR)$(devsdir)/nvram c 10 144; \ chmod 644 $(DESTDIR)$(devsdir)/nvram; \ fi @if [ ! -c $(DESTDIR)$(devsdir)/mixer ]; then \ echo "Creating $(DESTDIR)$(devsdir)/mixer ..."; \ mknod $(DESTDIR)$(devsdir)/mixer c 14 0; \ chmod 644 $(DESTDIR)$(devsdir)/mixer; \ fi @if [ ! -c $(DESTDIR)$(devsdir)/dsp ]; then \ echo "Creating $(DESTDIR)$(devsdir)/dsp ..."; \ mknod $(DESTDIR)$(devsdir)/dsp c 14 3; \ chmod 644 $(DESTDIR)$(devsdir)/dsp; \ fi @if [ ! -c $(DESTDIR)$(devsdir)/audio ]; then \ echo "Creating $(DESTDIR)$(devsdir)/audio ..."; \ mknod $(DESTDIR)$(devsdir)/audio c 14 4; \ chmod 644 $(DESTDIR)$(devsdir)/audio; \ fi @if [ ! -c $(DESTDIR)$(devsdir)/sndstat ]; then \ echo "Creating $(DESTDIR)$(devsdir)/sndstat ..."; \ mknod $(DESTDIR)$(devsdir)/sndstat c 14 6; \ chmod 600 $(DESTDIR)$(devsdir)/sndstat; \ fi install: all man installdirs $(INSTALL) -m 4511 clock $(DESTDIR)$(sbindir) $(INSTALL) -m 755 nvsetenv nvvideo $(DESTDIR)$(sbindir) $(INSTALL) -m 755 mousemode sndvolmix vmode $(DESTDIR)$(usbindir) $(INSTALL) -m 755 fdeject $(DESTDIR)/$(ubindir) $(INSTALL) -m 755 $(SCRIPTS) $(DESTDIR)$(sbindir) $(INSTALL) -m 644 fdeject.man $(DESTDIR)$(man1dir)/fdeject.1 $(INSTALL) -m 644 clock.man $(DESTDIR)$(man8dir)/clock.8 $(INSTALL) -m 644 mousemode.man $(DESTDIR)$(man8dir)/mousemode.8 $(INSTALL) -m 644 nvsetenv.man $(DESTDIR)$(man8dir)/nvsetenv.8 $(INSTALL) -m 644 nvvideo.man $(DESTDIR)$(man8dir)/nvvideo.8 $(INSTALL) -m 644 sndvolmix.man $(DESTDIR)$(man8dir)/sndvolmix.8 $(INSTALL) -m 644 vmode.man $(DESTDIR)$(man8dir)/vmode.8 $(INSTALL) -m 644 macos.man $(DESTDIR)$(man8dir)/macos.8 cleanobjs: $(RM) *.o *.bak *~ *.man *.1 *.8 clean: cleanobjs $(RM) $(PROGS) pmac-utils/mkinstalldirs100755 5313 5313 1212 6331065313 14107 0ustar heeshees#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1994-03-25 # Public domain errstatus=0 for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || errstatus=$? fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here pmac-utils/mousemode.c100600 5313 5313 5360 6525771121 13450 0ustar heeshees/* mousemode.c * * A program for linux-pmac by jonh Tue Feb 18 00:46:10 EST 1997 * * which feeds the right things to /dev/adb to reconfigure * Apple Desktop Bus mice. It sets a mouse's ADB register 3 to the * command line argument, which tells the mouse to invoke a different * handler. Handler 4 on my Logitech mouse says to return extended data. * */ #include #include #include #include #include int fd; /* put this here where everybody can see it. Hey, it's not so */ /* much a global as it is an "object variable," where this */ /* program is the object. Yeah, that's it! Ahem. */ static void setmouse( int ); static int showmouse( void ); static void send( char *, int ); static void listen( char * ); int main(int argc, char **argv) { int mode; fd = open("/dev/adb", O_RDWR); if (fd <= 0) { perror("opening /dev/adb"); exit(EXIT_FAILURE); } if (argc >= 2) { mode = atoi(argv[1]); if ((argc == 2 && (mode <= 0 || mode >= 0x0fd)) || argc >= 3) { (void) printf("usage: mousemode [n]\n"); (void) printf(" Configures mouse at ADB address 3 to use handler ID n.\n"); (void) printf(" If n is omitted, prints value of current handler ID.\n"); exit(EXIT_FAILURE); } if (argc == 2) { setmouse(mode); } } (void) printf("%d\n", showmouse()); (void) close(fd); exit(EXIT_SUCCESS); } static void setmouse(int mode) { char y[15]; /* curious parties should read Inside Mac/Devices/ADB Manager, */ /* looking at page 5-11. Inside Mac is available as pdf files */ /* from Apple's site. */ /* CUDA device 0? (the clock seems to be at 1) */ y[0]=(char) 0x000; /* mouse (0x30) listen (0x08) reg 3 (0x03) */ y[1]=(char) 0x03b; /* service request enable (0x20), device addr 3 (0x03) */ y[2]=(char) 0x023; /* device handler ID == mode */ y[3]=(char) mode; send(y, 4); listen(y); } static int showmouse() { char y[15]; y[0]=(char) 0x000; /* Cuda device 0 */ y[1]=(char) 0x03f; /* mouse talk reg 3 */ send(y, 2); listen(y); /* make sure reply is from: */ if (y[0] == (char) 0 /* cuda device 0 */ && y[1] == (char) 0 /* no status/error bits (I'm guessing) */ && y[2] == (char) 0x03f) { /* mouse talk reg 3 */ /* skip 1st byte of reg 3, and return handler ID */ return( (int) y[4] ); } else { return -1; } } static void send(char *y, int len) { int n; n = (int) write(fd, y, (size_t) len); if (n < len) { perror("writing /dev/adb"); (void) close(fd); exit (EXIT_FAILURE); } } static void listen(char *y) { int n; do { n = (int) read(fd, y, (size_t) 80); if (n > 0) { y += (char) n; } else if (n<0) { perror("reading /dev/adb"); (void) close(fd); exit(EXIT_FAILURE); } } while (n > 0); } pmac-utils/nvvideo.sgml100644 5313 5313 4075 6555112106 13652 0ustar heeshees NAME

nvvideo - Powermac/Linux video/color mode selector SYNOPSIS

nvvideo DESCRIPTION

DEFINITIONS. OPTIONS

variable/ current value of given variable is returned, valid are video-mode and color-mode variable value/ value of given variable is changed to given value DEFINITIONS

Defined console video-modes are: 512x384 60Hz (Interlaced-NTSC), 512x384 60Hz, 640x480 50Hz (Interlaced-PAL), 640x480 60Hz (Interlaced-NTSC), 640x480 60Hz, 640x480 67Hz, 640x870 75Hz (Portrait), 768x576 50Hz (Interlaced-PAL), 800x600 56Hz, 800x600 60Hz, 800x600 72Hz, 800x600 75Hz, 832x624 75Hz, 1024x768 60Hz, 1024x768 72Hz, 1024x768 75Hz, 1024x768 75Hz, 1152x870 75Hz, 1280x960 75Hz, 1280x1024 75Hz.

Defined console color-modes are: 8 bit 16 bit 24 bit SEE ALSO

vmode(8) AUTHORS

Paul Mackerras (program) Richard van Hees (documentation) BUGS

You can not modify color or video settings with pmac-utils/macos100755 5313 5313 451 6345735665 12340 0ustar heeshees#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin # check that we are being run from the console if ! expr "`tty`" : '^/dev/tty[0-9]$' >/dev/null; then echo "Must be run from console" exit 1 fi nvsetenv boot-device /AAPL,ROM nvsetenv real-base ffffffff exec shutdown -t 1 -r now pmac-utils/COPYING100644 5313 5313 43076 6504150571 12375 0ustar heeshees GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, 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 Appendix: 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., 675 Mass Ave, Cambridge, MA 02139, 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. pmac-utils/vmode.sgml100644 5313 5313 3060 6541434633 13312 0ustar heeshees NAME

vmode - Powermac/Linux runtime video/color mode selector SYNOPSIS

DESCRIPTION

OPTIONS

video-resolution/ a number between 1 and 20 (see section video-depth / can be set to 8, 15, 16, 24 and 32 (24 and 32 are really the same). DEFINITIONS

Defined console video-resolutions are: 512x384 60Hz (Interlaced-NTSC), 512x384 60Hz, 640x480 50Hz (Interlaced-PAL), 640x480 60Hz (Interlaced-NTSC), 640x480 60Hz, 640x480 67Hz, 640x870 75Hz (Portrait), 768x576 50Hz (Interlaced-PAL), 800x600 56Hz, 800x600 60Hz, 800x600 72Hz, 800x600 75Hz, 832x624 75Hz, 1024x768 60Hz, 1024x768 72Hz, 1024x768 75Hz, 1024x768 75Hz, 1152x870 75Hz, 1280x960 75Hz, 1280x1024 75Hz. SEE ALSO

nvvideo(8) AUTHORS

Paul Mackerras (program) Richard van Hees (documentation) BUGS

You can not modify color or video settings with pmac-utils/nvsetenv.sgml100644 5313 5313 5601 6541443157 14054 0ustar heeshees NAME

SYNOPSIS

nvsetenv DESCRIPTION

OPTIONS

variable/ nvsetenv will show current value of an OF's variable, if no value is given variable value/ nvsetenv will set variable to value EXAMPLES

This example will set the boot device to the first SCSI disk on the internal SCSI bus, using /vmlinux as boot image, trying to use the third partition as root partition. > nvsetenv boot-device "scsi-int/sd@0:0" > nvsetenv boot-file " /vmlinux root=/dev/sda3" Alternatives boot devices are: scsi/sd@1:0 SCSI disk at ID 1 ata/ata-disk@0:0 Internal IDE disk You can also boot from a floppy, you need a XCOFF-format kernel image (in this example: vmlinux.coff), copied to a HFS format high-density (1.44Mb) floppy. > nvsetenv boot-device "fd:vmlinux.coff" > nvsetenv boot-file " root=/dev/sda3" To return to MacOS, do: > nvsetenv boot-device "/AAPL,ROM" Valid values for "input-devices" are: ttya Modem serial port ttyb Printer serial port kbd Keyboard enet Ethernet interface Valid values for "output-devices" are (machine and/or OF dependent): screen Screen display (newer machines) /chaos/control Screen display (7500, 7600 and 8500) /bandit/ATY,264GT-B Screen display (6500) OF is not designed to wait for your hard disk to spin up (remember MacOS boots from ROM). Use the following setting to have OF retry to boot from your disk until is has spun up: > nvsetenv boot-command "begin ['] boot catch 1000 ms cr again" You only have to append an "S" to the "boot-file" variable to boot Linux in single user mode. FILES

/dev/nvram character device with major number 10 and minor number 144 SEE ALSO

macos(8) AUTHORS

Paul Mackerras (program) Richard van Hees (documentation) pmac-utils/clock.sgml100644 5313 5313 5435 6555111405 13275 0ustar heeshees NAME

clock - manipulate the CMOS clock SYNOPSIS

clock [] [] [ DESCRIPTION

clock manipulates the CMOS clock in variaous ways, allowing it to be read or written, and allowing synchronization between the CMOS clock and the kernel's version of the system time. OPTIONS

indicates that the CMOS clock is set to universal time read CMOS clock and print the result to stdout write the system time into the CMOS clock set the system time from the CMOS clock set the system time from the CMOS clock, adjusting the time to correct for systematic error, and writting it back into the CMOS clock. print version number The /etc/adjtime to determine how the clock changes. It contains three numbers: the correction in seconds per day (for example, if your clock runs 5 seconds fast each day, the first number should read -5.0), time when clock was last used, in seconds since 1/1/1970, the remaining part of a second that was left over after the last adjustment.

The following instructions are from the source code: create a file /etc/adjtime containing as the first and only line: '0.0 0 0.0', run clock -au or clock -a, depending on whether your CMOS is in Universal or Local Time. This updates the second number, set your system time using the date command, update your CMOS time using clock -wu or clock -w, replace the first number in /etc/adjtime by your correction, put the command clock -au or clock -a in your /etc/rc.local, or let cron start it regularly. FILES

/etc/adjtime /etc/rc.local AUTHORS

Charles Hedrick, hedrick@cs.rutgers.edu, Apr 1992 Modified for clock adjustments, Rob Hooft, hooft@chem.ruu.nl, Nov 1992 Patches by Harald Koenig, koenig@nova.tat.physik.uni-tuebingen.de, applied by Rob Hooft, hooft@EMBL-Heidelberg.DE, Oct 1993 Changes from alan@spri.levels.unisa.edu.au (Alan Modra) Fix for years > 2000 alan@SPRI.Levels.UniSA.Edu.Au (Alan Modra), and added Converted to be compatible with the SPARC /dev/rtc driver Tom Dyas (tdyas@eden.rutgers.edu), Aug 1996 Adapted for Power Macintosh by Paul Mackerras, Dec 1996 pmac-utils/macos.sgml100644 5313 5313 725 6541443671 13271 0ustar heeshees NAME

macos - reboot into MacOS SYNOPSIS

macos DESCRIPTION

macos changes the OF variables to boot MacOS, and reboots the system into MacOS. Can only be run from console (as root). AUTHORS

Paul Mackerras (program) Richard van Hees (documentation) pmac-utils/fdeject.sgml100644 5313 5313 1111 6541444033 13572 0ustar heeshees NAME

SYNOPSIS

DESCRIPTION

OPTIONS

device/ name of your floppy device, default: /dev/fd0 AUTHORS

Paul Mackerras (program) Richard van Hees (documentation) BUGS

none ;-) pmac-utils/mousemode.sgml100644 5313 5313 1762 6541443416 14203 0ustar heeshees NAME

mousemode - tell the mouse to use a given device handler ID SYNOPSIS

DESCRIPTION

mousemode tells the mouse to use a given device handler ID (``mode''), and then asks the mouse what mode it's really in. The mouse only "sticks" in modes it supports. mousemode with no arguments just queries the mouse's mode and prints it, without trying to change it. OPTIONS

mode/ number of mouse ``mode'', i.e. 4 is the extended mouse protocol FILES

mousemode needs the following device: /dev/adb character device with major number 56 and minor number 0 AUTHORS

Paul Mackerras (program) Richard van Hees (documentation) BUGS

none ;-) pmac-utils/sndvolmix.sgml100644 5313 5313 3331 6541442047 14222 0ustar heeshees NAME

SYNOPSIS

sndvolmix [] [] [] [] [] [ DESCRIPTION

OPTIONS

mute headphones activate Audio In play-through activate Cdrom play-through activate Microphone play-through master volume can be specified in a range of 0-15 for both channels, or for left and right separately. NOTES

First of all you need a kernel with sound support. Scan the output of the command or the sndstat device (use cat) for sound support. /dev/mem, therefor you need to be superuser, or "set UID" of this program must be set. BUGS

SEE ALSO

dmesg(8) AUTHORS

Bibek Sahu (program) Richard van Hees (documentation) pmac-utils/awacs_defs.h100644 5313 5313 16331 6430065427 13607 0ustar heeshees /*********************************************************/ /* This file was written by someone, somewhere, sometime */ /* And is released into the Public Domain */ /*********************************************************/ #ifndef _AWACS_DEFS_H_ #define _AWACS_DEFS_H_ /**********************/ /* AWACs DMA Channels */ /**********************/ #define AUD_DMA_IN ((unsigned *) 0x09) #define AUD_DMA_OUT ((unsigned *) 0x08) /********************************/ /* AWACs DMA Register Addresses */ /********************************/ #define AUD_OUT_DMAREG ((unsigned *) 0xf3008800) #define AUD_OUT_CHCONT ((unsigned *) 0xf3008800) #define AUD_OUT_CHSTAT ((unsigned *) 0xf3008804) #define AUD_OUT_CMDPTR ((unsigned *) 0xf300880c) #define AUD_OUT_INTRSEL ((unsigned *) 0xf3008810) #define AUD_OUT_BRSEL ((unsigned *) 0xf3008814) #define AUD_OUT_WAITSEL ((unsigned *) 0xf3008818) #define AUD_IN_DMAREG ((unsigned *) 0xf3008900) #define AUD_IN_CHCONT ((unsigned *) 0xf3008900) #define AUD_IN_CHSTAT ((unsigned *) 0xf3008904) #define AUD_IN_CMDPTR ((unsigned *) 0xf300890c) #define AUD_IN_INTRSEL ((unsigned *) 0xf3008910) #define AUD_IN_BRSEL ((unsigned *) 0xf3008914) #define AUD_IN_WAITSEL ((unsigned *) 0xf3008918) /**********************************/ /* AWACs Audio Register Addresses */ /**********************************/ #define AUD_CONT ((unsigned *) 0xf3014000) #define AUD_COD_CONT ((unsigned *) 0xf3014010) #define AUD_COD_STAT ((unsigned *) 0xf3014020) #define AUD_CLIP_CNT ((unsigned *) 0xf3014030) #define AUD_BYTESWAP ((unsigned *) 0xf3014040) /*******************/ /* Audio Bit Masks */ /*******************/ /* Audio Control Reg Bit Masks */ /* ----- ------- --- --- ----- */ #define MASK_ISFSEL (0xf) /* Input SubFrame Select */ #define MASK_OSFSEL (0xf << 4) /* Output SubFrame Select */ #define MASK_RATE (0x7 << 8) /* Sound Rate */ #define MASK_CNTLERR (0x1 << 11) /* Error */ #define MASK_PORTCHG (0x1 << 12) /* Port Change */ #define MASK_IEE (0x1 << 13) /* Enable Interrupt on Error */ #define MASK_IEPC (0x1 << 14) /* Enable Interrupt on Port Change */ #define MASK_SSFSEL (0x3 << 15) /* Status SubFrame Select */ /* Audio Codec Control Reg Bit Masks */ /* ----- ----- ------- --- --- ----- */ #define MASK_NEWECMD (0x1 << 24) /* Lock: don't write to reg when high */ #define MASK_EMODESEL (0x3 << 22) /* Send info out on which frame? */ #define MASK_EXMODEADDR (0x3ff << 12) /* Extended Mode Address -- 10 bits (12-21) */ #define MASK_EXMODEDATA (0xfff) /* Extended Mode Data -- 12 bits (0-11) */ /* Audio Codec Control Address Values / Masks */ /* ----- ----- ------- ------- ------ - ----- */ #define MASK_ADDR0 (0x0 << 12) /* Expanded Data Mode Address 0 */ #define MASK_ADDR_MUX MASK_ADDR0 /* Mux Control */ #define MASK_ADDR_GAIN MASK_ADDR0 #define MASK_ADDR1 (0x1 << 12) /* Expanded Data Mode Address 1 */ #define MASK_ADDR_MUTE MASK_ADDR1 #define MASK_ADDR_RATE MASK_ADDR1 #define MASK_ADDR2 (0x2 << 12) /* Expanded Data Mode Address 2 */ #define MASK_ADDR_VOLA MASK_ADDR2 /* Volume Control A -- Speaker */ #define MASK_ADDR_VOLSPK MASK_ADDR2 #define MASK_ADDR4 (0x4 << 12) /* Expanded Data Mode Address 4 */ #define MASK_ADDR_VOLC MASK_ADDR4 /* Volume Control C -- Headphones */ #define MASK_ADDR_VOLHD MASK_ADDR4 /* Address 0 Bit Masks & Macros */ /* ------- - --- ----- - ------ */ #define MASK_GAINRIGHT (0xf) /* Gain Right Mask */ #define MASK_GAINLEFT (0xf << 4) /* Gain Left Mask */ #define MASK_GAINLINE (0x1 << 8) /* Change Gain for Line??? */ #define MASK_GAINMIC (0x0 << 8) /* Change Gain for Mic??? */ #define MASK_MUX_CD (0x1 << 9) /* Select CD in MUX */ #define MASK_MUX_MIC (0x1 << 10) /* Select Mic in MUX */ #define MASK_MUX_AUDIN (0x1 << 11) /* Select Audio In in MUX */ #define MASK_MUX_LINE MASK_MUX_AUDIN #define GAINRIGHT(x) ((x) & MASK_GAINRIGHT) #define GAINLEFT(x) (((x) << 4) & MASK_GAINLEFT) /* Address 1 Bit Masks */ /* ------- - --- ----- */ #define MASK_ADDR1RES1 (0x3) /* Reserved */ #define MASK_RECALIBRATE (0x1 << 2) /* Recalibrate */ #define MASK_SAMPLERATE (0x7 << 3) /* Sample Rate: */ #define MASK_LOOPTHRU (0x1 << 6) /* Loopthrough Enable */ #define MASK_CMUTE (0x1 << 7) /* Output C (Headphone) Mute */ #define MASK_HDMUTE MASK_CMUTE #define MASK_ADDR1RES2 (0x1 << 8) /* Reserved */ #define MASK_AMUTE (0x1 << 9) /* Output A (Speaker) Mute */ #define MASK_SPKMUTE MASK_AMUTE #define MASK_PAROUT (0x3 << 10) /* Parallel Out (???) */ #define SAMPLERATE_48000 (0x0 << 3) /* 48 kHz */ #define SAMPLERATE_32000 (0x1 << 3) /* 32 kHz */ #define SAMPLERATE_24000 (0x2 << 3) /* 24 kHz */ #define SAMPLERATE_19200 (0x3 << 3) /* 19.2 kHz */ #define SAMPLERATE_16000 (0x4 << 3) /* 16 kHz */ #define SAMPLERATE_12000 (0x5 << 3) /* 12 kHz */ #define SAMPLERATE_9600 (0x6 << 3) /* 9.6 kHz */ #define SAMPLERATE_8000 (0x7 << 3) /* 8 kHz */ /* Address 2 & 4 Bit Masks & Macros */ /* ------- - - - --- ----- - ------ */ #define MASK_OUTVOLRIGHT (0xf) /* Output Right Volume */ #define MASK_ADDR2RES1 (0x2 << 4) /* Reserved */ #define MASK_ADDR4RES1 MASK_ADDR2RES1 #define MASK_OUTVOLLEFT (0xf << 6) /* Output Left Volume */ #define MASK_ADDR2RES2 (0x2 << 10) /* Reserved */ #define MASK_ADDR4RES2 MASK_ADDR2RES2 #define VOLRIGHT(x) (((~(x)) & MASK_OUTVOLRIGHT)) #define VOLLEFT(x) (((~(x)) << 6) & MASK_OUTVOLLEFT) /* Audio Codec Status Reg Bit Masks */ /* ----- ----- ------ --- --- ----- */ #define MASK_EXTEND (0x1 << 23) /* Extend */ #define MASK_VALID (0x1 << 22) /* Valid Data? */ #define MASK_OFLEFT (0x1 << 21) /* Overflow Left */ #define MASK_OFRIGHT (0x1 << 20) /* Overflow Right */ #define MASK_ERRCODE (0xf << 16) /* Error Code */ #define MASK_REVISION (0xf << 12) /* Revision Number */ #define MASK_MFGID (0xf << 8) /* Mfg. ID */ #define MASK_CODSTATRES (0xf << 4) /* bits 4 - 7 reserved */ #define MASK_INPPORT (0xf) /* Input Port */ /* Clipping Count Reg Bit Masks */ /* -------- ----- --- --- ----- */ #define MASK_CLIPLEFT (0xff << 7) /* Clipping Count, Left Channel */ #define MASK_CLIPRIGHT (0xff) /* Clipping Count, Right Channel */ /* ChannelStatus Bit Masks */ /* ------------- --- ----- */ #define MASK_CSERR (0x1 << 7) /* Error */ #define MASK_EOI (0x1 << 6) /* End of Input -- only for Input Channel */ #define MASK_CSUNUSED (0x1f << 1) /* bits 1-5 not used */ #define MASK_WAIT (0x1) /* Wait */ /* Various Rates */ /* ------- ----- */ #define RATE_48000 (0x0 << 8) /* 48 kHz */ #define RATE_44100 (0x0 << 8) /* 44.1 kHz */ #define RATE_32000 (0x1 << 8) /* 32 kHz */ #define RATE_29400 (0x1 << 8) /* 29.4 kHz */ #define RATE_24000 (0x2 << 8) /* 24 kHz */ #define RATE_22050 (0x2 << 8) /* 22.05 kHz */ #define RATE_19200 (0x3 << 8) /* 19.2 kHz */ #define RATE_17640 (0x3 << 8) /* 17.64 kHz */ #define RATE_16000 (0x4 << 8) /* 16 kHz */ #define RATE_14700 (0x4 << 8) /* 14.7 kHz */ #define RATE_12000 (0x5 << 8) /* 12 kHz */ #define RATE_11025 (0x5 << 8) /* 11.025 kHz */ #define RATE_9600 (0x6 << 8) /* 9.6 kHz */ #define RATE_8820 (0x6 << 8) /* 8.82 kHz */ #define RATE_8000 (0x7 << 8) /* 8 kHz */ #define RATE_7350 (0x7 << 8) /* 7.35 kHz */ #define RATE_LOW 1 /* HIGH = 48kHz, etc; LOW = 44.1kHz, etc. */ #endif /* _AWACS_DEFS_H_ */ pmac-utils/README100664 5313 5313 2166 6504152173 12177 0ustar heesheesThis package contains utilities which are developed to be useful for the monolithic port of Linux to PCI Power Macintoshes. However, some of them might also be useful for MkLinux ;-) clock, fdeject, macos, nvsetenv, nvvideo, and vmode are Copyright (C) 1996-1998 by Paul Mackerras. sndvolmix is Copyright (C) 1996-1998 by Bibek Sahu. mousemode is Copyright (C) 1996-1998 by Jon Howell. The following license applies to each of the programs. 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, 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. pmac-utils/pmac-utils-1.1.3.lsm100644 5313 5313 1351 6555112246 14544 0ustar heesheesBegin Title: pmac-utils Version: 1.1.3 Entered-date: July 21 1998 Description: Utilities needed by the monolithic port of Linux to PCI Power Macintoshes, included are clock, fdeject, macos, mousemode, nvsetenv, nvvideo, sndvolmix, vmode Keywords: Utilities/System Author(s): Paul Mackerras: clock, fdeject, macos, nvsetenv, nvvideo, vmode Bibek Sahu: sndvolmix Jon Howell: mousemode Richard van Hees: man-pages Maintained-by: R.M.vanHees@phys.uu.nl (Richard van Hees) Primary-site: ftp://ftp.linuxppc.org/RedHat Original-site: ftp://fysvp.phys.uu.nl/pub/redhat 10kB pmac-utils-1.1.2.tar.gz 1kB pmac-utils-1.1.2.lsm Platform: Powermac/Linux (monolithic port) Copying-policy: GPL End