/*
display v1.0
This program allows access to the PS/2 front panel display.
I've only seen this display on Model 95 machines, but others may have it
too. (email me if you know of any)
The display is located at ports 0x108 thru 0x10f, mapped backward (the
first character of the display is 0x10f, and the last is 0x108)
This program must be compiled with -O
bash% gcc -O display.c -o display
Because it accesses ports, this program must be run as root. This means
either root must run it, or it must be owned by root with the suid bit
set (chown root.root display ; chmod 4755 display)
Feel free to send me any comments or questions...
Jason Harper
[email protected]
*/
/* Kernel source-tree must be properly installed for these includes */
#include
#include
main(argc, argv)
int argc;
char *argv[];
{
char b;
char len;
char *s;
char *progname;
/* Give us permissions to the PS/2 display ports */
ioperm(0x108,8,1);
progname = argv[0];
if (argc==1) {
printf("This utility writes a string of characters\n");
printf("on the front panel display of an IBM PS/2 Model 95\n");
printf("(and maybe other PS/2's? (are there any more with displays?))\n\n");
printf("Remember, the display is broken into 2 groups of 4 characters.\n\n");
printf("Author: [email protected]\n\n");
printf("Usage: bash# %s <1-8 characters to display on panel>\n\n",progname);
printf("Use a } character for a space\n\n");
exit(1);
}
s = argv[1];
/* Truncate to 8 chars */
if (strlen(s) > 8)
s[8] = '\0';
/* convert }'s to spaces */
len = strlen(s);
for (b = 1; b <= len; b++)
if (s[b-1] == '}')
s[b-1] = ' ';
printf("Writing \"%s\" to the front panel display...\n", s);
/* clear display first */
for (b = 1; b<= 8; b++)
outb(32,272-b);
len = strlen(s);
for (b = 1; b <= len; b++)
outb(s[b-1],272-b);
}