From owner-freebsd-current Fri Feb 22 2:17:13 2002 Delivered-To: freebsd-current@freebsd.org Received: from mail12.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by hub.freebsd.org (Postfix) with ESMTP id 1813137B416 for ; Fri, 22 Feb 2002 02:17:07 -0800 (PST) Received: (qmail 30567 invoked from network); 22 Feb 2002 10:17:05 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([65.91.136.163]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 22 Feb 2002 10:17:05 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Fri, 22 Feb 2002 05:17:05 -0500 (EST) From: John Baldwin To: current@FreeBSD.org Subject: device figlet for the kernel Cc: msmith@FreeBSD.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Those of you who waste large amounts of time on IRC, esp. on The Channel Which Shall Rename Nameless will appreciate this: figlet is this nifty little ASCII art tool that Alfred likes to use a lot. He has since gotten several other people hooked on using it, and a sort of running joke has been to get figlet into the kernel. (Imagine ASCII part panic messages for example.) Mike Smith ported the figlet program as a filter on the low-level console output by taking over v_putc a while ago but it had an annoying bug where it only printed one char out at a time. During some down time tonight during which my brain was vegging, I picked up the code, tracked down the bug and added some features: - Originally, once figlet was initialized, it was turned on until you rebooted. Now it defaults to being off, but you can change that via a loader tunable (kern.figlet_enable). Also, there is an escape character that you can use to send commands to the figlet filter. Right now the only commands are to turn on figlet output; adjust the justification of the outputted text as either left, center, or right aligned; or turn off figlet output and revert to normal output. When figlet is turned off, the justification is reset to the default of left. - figlet is not a psuedo device that can be conditionally compiled into the kernel by putting 'device figlet' in your kernel config file - a spin lock has been added to protect the state machine variables so that it is SMPng safe. - a new console API function cnsetputc() has been added so that v_putc can be changed at runtime. This isn't quite right as v_putc really needs a lock now. Currently figlet isn't a kernel module, but one could make it so without too much additional work. To play with this, first download and apply the patch at http://www.FreeBSD.org/~jhb/patches/figlet.patch Then compile a kernel with 'device figlet'. You will need to load a figlet font file in the loader when you boot. You can get font files from either the figlet or figlet-fonts ports. For example, if you copy /usr/local/share/figlet/standard.flf (the default font) to /boot, then you would need to either use 'load -t figlet_font /boot/standard.flf' prior to booting the kernel or add the following to /boot/loader.conf: font_load="YES" font_name="/boot/standard.flf" font_type="figlet_font" The patch includes a sample SYSINIT at the bottom of subr_figlet.c that demonstrates sending commands to the filter. So who's going to do subr_jive.c next? :) -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message