lkml.org 
[lkml]   [1998]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] framebuffer devfs support (umm redone..)
Welp i went back and noticed my stupidity (thanks to many emails notifying me of it)
now the code is in fbmem.c only. I changed it to make only numerical entries in /dev/fb
and link them as fb<device number> in /dev. It also now only creates entries for the devices
you have. Works perfectly on my box. If anybody has any complaints, suggestions, objections
tell me. If something seems wrong, it probably is so tell me.
Sincerely,
Mark Guzman
--- /mnt/src/linux/drivers/char/fbmem.c Wed Jul 29 17:37:05 1998
+++ drivers/char/fbmem.c Wed Jul 29 17:26:43 1998
@@ -28,6 +28,9 @@
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
#endif
+#ifdef CONFIG_DEVFS_FS
+#include <linux/devfs_fs.h>
+#endif /*CONFIG_DEVFS_FS*/

#ifdef __mc68000__
#include <asm/setup.h>
@@ -478,7 +481,7 @@
int i, j;
static int fb_ever_opened[FB_MAX];
static int first = 1;
-
+
if (num_registered_fb == FB_MAX)
return -ENXIO;
num_registered_fb++;
@@ -500,9 +503,9 @@

if (first) {
first = 0;
- take_over_console(&fb_con, 12, MAX_NR_CONSOLES-1, 1);
+ take_over_console(&fb_con, 0, MAX_NR_CONSOLES-1, 1);
}
-
+
return 0;
}

@@ -526,6 +529,44 @@
static struct proc_dir_entry *proc_fbmem;
#endif

+/* segfault - July 28 1998 - framebuffer devfs support */
+/* `- added this to make it work right w/ devfs */
+#ifdef CONFIG_DEVFS_FS
+#define FB_MINOR 0
+#define DEVFS_FB_DIRECTORY "fb"
+char *
+framebuffer_make_lnkname(char *buf, char *name, int idx) {
+ sprintf(buf, "%s%d", name, idx);
+ return buf;
+}
+char *
+framebuffer_make_name(char *buf, int idx) {
+ sprintf(buf, DEVFS_FB_DIRECTORY "/" "%d", idx);
+ return buf;
+}
+/* Register framebuffer entries */
+void
+framebuffer_register_devfs(void)
+{
+ char name_buf[32];
+ char lnk_buf[32];
+ int j;
+
+ for (j=0; j<num_registered_fb || j==0; j++) {
+ framebuffer_make_name(name_buf, j); /* create the actual chardev name*/
+ devfs_register(name_buf, 0, DEVFS_FL_TOLERANT,
+ FB_MAJOR, FB_MINOR+(j*0x20),
+ S_IFCHR | S_IRUGO | S_IWUGO, 0, 0, &fb_fops, NULL);
+ framebuffer_make_lnkname(lnk_buf, "fb", j); /* create the symlnk name*/
+ devfs_mk_symlink(NULL, lnk_buf, 0,
+ DEVFS_FL_TOLERANT,
+ name_buf, 0, NULL);
+ }
+}
+#endif /*CONFIG_DEVFS_FS*/
+/* segfault - July 28 1998 - framebuffer support for devfs*/
+
+
__initfunc(void
fbmem_init(void))
{
@@ -537,6 +578,7 @@
proc_fbmem->read_proc = fbmem_read_proc;
#endif

+ framebuffer_register_devfs(); /*register all the fb devices*/
if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
printk("unable to get major %d for fb devs\n", FB_MAJOR);

@@ -651,3 +693,4 @@

EXPORT_SYMBOL(register_framebuffer);
EXPORT_SYMBOL(unregister_framebuffer);
+EXPORT_SYMBOL(framebuffer_register_devfs);
\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.040 / U:1.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site