Return-Path: amcl@flash.net Received: from crius.flash.net (crius-origin.flash.net [209.30.0.49]) by glitnir.cfar.umd.edu (8.9.3/8.9.1) with ESMTP id BAA07211 for ; Thu, 29 Apr 1999 01:10:43 -0400 (EDT) Received: from localhost (p70.amax2.dialup.dal1.flash.net [208.194.208.70]) by crius.flash.net (8.9.1/8.8.5) with ESMTP id AAA13819 for ; Thu, 29 Apr 1999 00:10:40 -0500 (CDT) Received: (from amcl@localhost) by localhost (8.9.3/8.9.3) id AAA01061 for arensb@ooblick.com; Thu, 29 Apr 1999 00:13:18 -0500 (CDT) (envelope-from amcl) Date: Thu, 29 Apr 1999 00:13:17 -0500 From: Alan McLean To: arensb@ooblick.com Subject: matrix_saver Message-ID: <19990429001317.A925@flash.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=T4sUOijqQbZv57TR X-Mailer: Mutt 0.95.4i Status: RO X-Status: A --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Hello Andrew, Very nice work! :) I run 3.1-STABLE and -CURRENT systems where lkms' are deprecated. I converted it from an lkm to a kld referring to the daemon_saver kld. I have attached a diff incase you are interested. I believe that there might be a license conflict since the module is linking with the kernel which is under BSDL. I think you would have a good chance of getting it included in the mainline sources with a license change if you wanted to do that. Just an idea, I am not anti-GPL at all. I happily run Linux and the Hurd aswell. All this free software is tremendous! It would be cool though to see this in the FreeBSD distribution. If you do consider this you can find a pastable example of a BSD style license on your system here, /usr/share/examples/etc/bsd-style-copyright Again, excellent work and thanks for releasing it! :) -amcl --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="matrix_saver-1.0.0-kld.diff" diff -ruN matrix_saver-1.0.0/README matrix_saver-1.0.0-kld/README --- matrix_saver-1.0.0/README Sun Apr 25 04:24:11 1999 +++ matrix_saver-1.0.0-kld/README Wed Apr 28 18:40:57 1999 @@ -1,35 +1,41 @@ matrix_saver - This is a text-mode screen saver for FreeBSD 3.x, based on an + This is a text-mode screen saver for FreeBSD [34].x, based on an effect in the 1999 movie, "The Matrix," and more immediately inspired by Chris Allegretta's 'cmatrix', a way cool display hack. * TO INSTALL: Copy the entire 'matrix' directory to -/usr/src/lkm/syscons/matrix, alongside all the other screen savers. +/usr/src/sys/modules/syscons/matrix, alongside all the other screen savers. Build it: - cd /usr/src/lkm/syscons/matrix + cd /usr/src/sys/modules/syscons/matrix make make install - Edit /etc/rc.conf . Find the line that begins with "saver=", -and change it to read + Edit /etc/rc.conf and add - saver="matrix" +saver="matrix" -(and make sure that "blanktime" is set to a reasonable value, like -300). + or replace the current value if one is already set. + + In FreeBSD 3.1+ "blanktime" is set to 300 seconds in +/etc/defaults/rc.conf. If you want to change this then override +blanktime in /etc/rc.conf. You can also adjust it with vidcontrol +as root, f.e. + + vidcontrol -t 30 + +would set it to 30 seconds. Now either reboot, or load the screen saver manually. To install it manually: - - Use 'modstat' to get the ID of your current screen saver. - - Use 'modunload -i ' to unload it; is the ID that + - Use 'kldstat' to get the ID of your current screen saver. + - Use 'kldunload -i ' to unload it; is the ID that you found in the previous step. - - Install matrix_saver: - modload -u -o /tmp/saver_mod -q /lkm/matrix_saver_mod.o + - Install matrix_saver: 'kldload matrix_saver.ko' (or look for "saver" in /etc/rc.i386, and do what it does) diff -ruN matrix_saver-1.0.0/matrix/Makefile matrix_saver-1.0.0-kld/matrix/Makefile --- matrix_saver-1.0.0/matrix/Makefile Sun Apr 25 04:24:40 1999 +++ matrix_saver-1.0.0-kld/matrix/Makefile Wed Apr 28 18:41:36 1999 @@ -1,6 +1,6 @@ # $Id: Makefile,v 1.1 1999/04/25 09:24:40 arensb Exp $ -KMOD= matrix_saver_mod +KMOD= matrix_saver SRCS= matrix_saver.c NOMAN= diff -ruN matrix_saver-1.0.0/matrix/matrix_saver.c matrix_saver-1.0.0-kld/matrix/matrix_saver.c --- matrix_saver-1.0.0/matrix/matrix_saver.c Sun Apr 25 04:24:44 1999 +++ matrix_saver-1.0.0-kld/matrix/matrix_saver.c Wed Apr 28 18:44:27 1999 @@ -26,25 +26,24 @@ * work. * * $Id: matrix_saver.c,v 1.1 1999/04/25 09:24:44 arensb Exp $ + * + * 28apr99 amcl + * Converted lkm to kld. */ #include #include -#include -#include -#include +#include #include +#include #include #include #include -MOD_MISC(matrix_saver); - -extern timeout_t scrn_timer; - static u_short *window; +static int blanked; /* Columns: * The screen saver displays a number of falling columns. Each column @@ -118,8 +117,8 @@ /* matrix_saver * Main loop for the screen saver. Most of this is voodoo code. */ -static void -matrix_saver(int blank) +static int +matrix_saver(video_adapter_t *adp, int blank) { scr_stat *scp = cur_console; static char beat = 0; /* Current beat. See comment above */ @@ -129,14 +128,12 @@ beat %= NUM_SPEEDS; if (blank) { - if (!ISTEXTSC(scp)) - return; - if (scrn_blanked <= 0) { + if (adp->va_info.vi_flags & V_INFO_GRAPHICS) + return EAGAIN; + if (blanked == 0) { /* Initialize the screen saver */ - - scp->status |= SAVER_RUNNING; - window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window; - scrn_blanked = 1; + window = (u_short *)adp->va_window; + blanked = 1; /* Erase the screen */ fillw((FG_MAGENTA|BG_BLACK)<<8|scr_map[0x20], window, @@ -204,21 +201,15 @@ lengths[x]--; } } - } - else { - /* Turn off the screen saver */ - if (scrn_blanked > 0) { - set_border(scp, scp->border); - scrn_blanked = 0; - scp->status &= ~SAVER_RUNNING; - } - } + } else /* Turn off the screen saver */ + blanked = 0; + + return 0; } static int -matrix_saver_load(struct lkm_table *lkmtp, int cmd) +matrix_init(video_adapter_t *adp) { - int err; int i; scr_stat *scp = cur_console; @@ -237,33 +228,22 @@ tails[i] = (random() % 30) + 5; speeds[i] = random() % NUM_SPEEDS; } - if ((err = add_scrn_saver(matrix_saver)) != 0) - { - free(lengths, M_DEVBUF); - free(tails, M_DEVBUF); - free(speeds, M_DEVBUF); - } - return err; + + return 0; } static int -matrix_saver_unload(struct lkm_table *lkmtp, int cmd) +matrix_term(video_adapter_t *adp) { - int err; + free(lengths, M_DEVBUF); + free(tails, M_DEVBUF); + free(speeds, M_DEVBUF); - err = remove_scrn_saver(matrix_saver); - if (err == 0) - { - free(lengths, M_DEVBUF); - free(tails, M_DEVBUF); - free(speeds, M_DEVBUF); - } - return err; + return 0; } -int -matrix_saver_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - MOD_DISPATCH(matrix_saver, lkmtp, cmd, ver, - matrix_saver_load, matrix_saver_unload, lkm_nullcmd); -} +static scrn_saver_t matrix_module = { + "matrix_saver", matrix_init, matrix_term, matrix_saver, NULL, +}; + +SAVER_MODULE(matrix_saver, matrix_module); --T4sUOijqQbZv57TR--