[MPlayer-matrox] [PATCH] udev support for mga_vid 2.6.11
Gergely Tamas
dice at mfa.kfki.hu
Sat Jun 4 18:33:27 CEST 2005
Hi!
Following patch extends mga_vid 2.6.11 with udev support.
--- >>> --- >>> --- >>> ---
diff -ur mga-vid-2.6.11~/mga_vid.c mga-vid-2.6.11/mga_vid.c
--- mga-vid-2.6.11~/mga_vid.c 2005-03-06 12:12:28.000000000 +0100
+++ mga-vid-2.6.11/mga_vid.c 2005-06-05 18:11:05.858378328 +0200
@@ -58,6 +58,8 @@
#include <linux/string.h>
#include <linux/errno.h>
+#include <linux/device.h>
+
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/init.h>
@@ -255,6 +257,9 @@
#define ICLEAR 0x1e18
#define STATUS 0x1e14
+struct class_simple *mga_vid_class;
+int mga_vid_major;
+
/* Global handles for cdev */
static struct cdev *mga_vid_cdev;
static dev_t mga_cdev_handle;
@@ -1130,8 +1135,14 @@
else
{
mga_cdev_handle = MKDEV(major,0);
- if(!register_chrdev_region(mga_cdev_handle, mga_cards_num, "mga_vid"))
+ if(!register_chrdev_region(mga_cdev_handle, mga_cards_num, "mga_vid")) {
+ mga_vid_major = major;
+
+ mga_vid_class = class_simple_create(THIS_MODULE, "mga_vid");
+ class_simple_device_add(mga_vid_class, MKDEV (mga_vid_major, 0), NULL, "mga_vid");
+
printk(KERN_INFO "mga_vid: using major: %d (assigned or default!)\n", major);
+ }
}
/* Allocate a cdev for this character device, and fill in some parameters it needs */
mga_vid_cdev = cdev_alloc();
@@ -1180,6 +1191,9 @@
}
}
+ class_simple_device_remove(MKDEV(mga_vid_major, 0));
+ class_simple_destroy(mga_vid_class);
+
//FIXME turn off BES
cdev_del(mga_vid_cdev);
unregister_chrdev_region(mga_cdev_handle, mga_cards_num);
--- <<< --- <<< --- <<< ---
Access permissions can be set ie.:
dice at moon:~$ cat /etc/udev/rules.d/mga_vid.rules
KERNEL="mga_vid", NAME="%k", MODE="0660", GROUP="video"
Gergely
More information about the MPlayer-matrox
mailing list