This ridiculously trivial diff (maybe in more than one sense :) adds
the file /proc/vidinfo to Linux (subproposal: officially rename /proc
to /sys ??).
I'm not doing a hell of a lot with the contents of said file myself,
other than grepping and cutting the "Mode line for a proper setting
for TERM at login. Well, this could be done by just greppingdmesg'
output, but for one thing, that output doesn't look much structured,
and for another I got the idea that in /proc we should at least be
able to find information about the video type and mode the system was
booted in, and perhaps other people have ideas that could make it
(even?) more useful than it looks now.
Right now what it outputs looks like this:
Type: ega+ color
Mode: 80x28
CRT index reg. port: 0x03d4
CRT value reg. port: 0x03d5
RAM: 0xb8000-0xc0000
Any additions I guess will have to come from people that have some
real knowledge of video hardware - among whom I don't consider
myself. So this is actually meant as a hint to them. If this whole
idea seems useless to the majority of us - so be it.
Btw, I don't think changing the mode in /proc/vidmode whenever
textmode is changed is feasible or even desired. As usual, I may be
wrong.
BJ
Yea, tho I walk through the valley of the shadow of death,
I shall fear no evil,
for I am the meanest son of a * in Western Europe
Have Linux - will travel
--- cut here ---
*** linux/fs/proc/array.c.orig Sat Apr 8 18:56:30 1995
--- linux/fs/proc/array.c Tue May 2 13:15:58 1995
***************
*** 27,30 ****
--- 27,33 ----
* Bruno Haible : remove 4K limit for the maps file
+ *
+ * Bauke Jan Douma : /proc/vidinfo
*/
***************
*** 325,328 ****
--- 328,386 ----
}
+ static int get_vidinfo(char * buffer)
+ {
+ unsigned long video_mem_base; /* Base of video memory */
+ unsigned long video_mem_term; /* End of video memory */
+ /* these two also used in vesa_blank.c */
+ unsigned short video_port_reg; /* Video register select port */
+ unsigned short video_port_val; /* Video register value port */
+ char *desc;
+
+ /* snatched from console.c -- bjd */
+ if (ORIG_VIDEO_MODE == 7) /* Is this a monochrome display? */
+ {
+ video_mem_base = 0xb0000;
+ video_port_reg = 0x3b4;
+ video_port_val = 0x3b5;
+ if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
+ {
+ video_mem_term = 0xb8000;
+ desc = "ega+ mono";
+ }
+ else
+ {
+ video_mem_term = 0xb2000;
+ desc = "mda";
+ }
+ }
+ else /* If not, it is color. */
+ {
+ video_mem_base = 0xb8000;
+ video_port_reg = 0x3d4;
+ video_port_val = 0x3d5;
+ if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
+ {
+ video_mem_term = 0xc0000;
+ desc = "ega+ color";
+ }
+ else
+ {
+ video_mem_term = 0xba000;
+ desc = "cga";
+ }
+ }
+
+ return sprintf(buffer, "Type:\t\t\t%s\n"
+ "Mode:\t\t\t%dx%d\n"
+ "CRT index reg. port:\t0x%04x\n"
+ "CRT value reg. port:\t0x%04x\n"
+ "RAM:\t\t\t0x%04lx-0x%04lx\n",
+ desc,
+ ORIG_VIDEO_COLS, ORIG_VIDEO_LINES,
+ video_port_reg,
+ video_port_val,
+ video_mem_base, video_mem_term );
+ }
+
static struct task_struct ** get_task(pid_t pid)
{
***************
*** 753,756 ****
--- 811,815 ----
extern int get_dma_list(char *);
extern int get_cpuinfo(char *);
+ extern int get_vidinfo(char *);
extern int get_pci_list(char*);
***************
*** 774,777 ****
--- 833,839 ----
case PROC_CPUINFO:
return get_cpuinfo(page);
+
+ case PROC_VIDINFO:
+ return get_vidinfo(page);
case PROC_VERSION:
*** linux/fs/proc/root.c.orig Thu Jan 12 15:53:04 1995
--- linux/fs/proc/root.c Fri Apr 28 20:25:04 1995
***************
*** 64,67 ****
--- 64,68 ----
#endif
{ PROC_CPUINFO, 7, "cpuinfo" },
+ { PROC_VIDINFO, 7, "vidinfo" },
{ PROC_SELF, 4, "self" }, /* will change inode # */
{ PROC_NET, 3, "net" },
*** linux/include/linux/proc_fs.h.orig Thu Feb 23 16:54:55 1995
--- linux/include/linux/proc_fs.h Fri Apr 28 20:25:55 1995
***************
*** 16,19 ****
--- 16,20 ----
PROC_VERSION,
PROC_CPUINFO,
+ PROC_VIDINFO,
PROC_PCI,
PROC_SELF, /* will change inode # */
--- cut here ---