Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2002 05:17:05 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        current@FreeBSD.org
Cc:        msmith@FreeBSD.org
Subject:   device figlet for the kernel
Message-ID:  <XFMail.020222051705.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org>  <><  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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.020222051705.jhb>