> p.
Here's a start - it allows "console" devices to be registered and unregistered
by modules, so the lp_console can be running only when you want it, not all
the time.
For an example of code which uses this, see Patrick Caulfield's MDA device
driver, which is on Sunsite. All you need is a non-IRQ driven character output
routine, and it's fairly trivial from then on.
--- linux/kernel/printk.c.precons Fri Dec 5 11:40:33 1997
+++ linux/kernel/printk.c Fri Dec 5 12:23:13 1997
@@ -378,6 +378,26 @@
}
}
+
+int unregister_console(struct console * console)
+{
+ struct console *a,*b;
+
+ if (console_drivers == console) {
+ console_drivers=console->next;
+ return (0);
+ }
+ for (a=console_drivers->next, b=console_drivers ;
+ a; b=a, a=b->next) {
+ if (a == console) {
+ b->next = a->next;
+ return 0;
+ }
+ }
+
+ return (1);
+}
+
/*
* Write a message to a certain tty, not just the console. This is used for
* messages that need to be redirected to a specific tty.
--- linux/kernel/ksyms.c.precons Tue Dec 2 19:41:45 1997
+++ linux/kernel/ksyms.c Fri Dec 5 11:58:42 1997
@@ -50,6 +50,7 @@
#include <linux/swap.h>
#include <linux/ctype.h>
#include <linux/file.h>
+#include <linux/console.h>
extern unsigned char aux_device_present, kbd_read_mask;
@@ -401,3 +402,7 @@
/* binfmt_aout */
EXPORT_SYMBOL(get_write_access);
EXPORT_SYMBOL(put_write_access);
+
+/* dynamic registering of consoles */
+EXPORT_SYMBOL(register_console);
+EXPORT_SYMBOL(unregister_console);
--- linux/include/linux/console.h.precons Thu Dec 4 23:27:11 1997
+++ linux/include/linux/console.h Fri Dec 5 11:58:42 1997
@@ -99,6 +99,7 @@
};
extern void register_console(struct console *);
+extern int unregister_console(struct console *);
extern struct console *console_drivers;
#endif /* linux/console.h */
-- ---- ---- ---- David Woodhouse, Robinson College, CB3 9AN, England. (+44) 0976 658355 Dave@imladris.demon.co.uk http://dwmw2.robinson.cam.ac.uk finger pgp@dwmw2.robinson.cam.ac.uk for PGP key.