[MPlayer-matrox] r244 - mga_vid/trunk/mga_vid.c
tamasg
subversion at mplayerhq.hu
Sat Jul 29 23:19:51 CEST 2006
Author: tamasg
Date: Sat Jul 29 23:19:51 2006
New Revision: 244
Modified:
mga_vid/trunk/mga_vid.c
Log:
Add udev support to mga_vid.
Put something like the following into '/etc/udev/rules.d/mga_vid.rules'
file :
KERNEL=="mga_vid", NAME="%k", MODE="0660", GROUP="video"
Modified: mga_vid/trunk/mga_vid.c
==============================================================================
--- mga_vid/trunk/mga_vid.c (original)
+++ mga_vid/trunk/mga_vid.c Sat Jul 29 23:19:51 2006
@@ -57,6 +57,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>
@@ -254,6 +256,9 @@
#define ICLEAR 0x1e18
#define STATUS 0x1e14
+struct class *mga_vid_class;
+int mga_vid_major;
+
/* Global handles for cdev */
static struct cdev *mga_vid_cdev;
static dev_t mga_cdev_handle;
@@ -1134,8 +1139,14 @@
else
{
mga_cdev_handle = MKDEV(major,0);
- if(!register_chrdev_region(mga_cdev_handle, mga_cards_num, "mga_vid"))
- printk(KERN_INFO "mga_vid: using major: %d (assigned or default!)\n", major);
+ if(!register_chrdev_region(mga_cdev_handle, mga_cards_num, "mga_vid")) {
+ mga_vid_major = major;
+
+ mga_vid_class = class_create(THIS_MODULE, "mga_vid");
+ class_device_create(mga_vid_class, NULL, 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();
@@ -1184,6 +1195,9 @@
}
}
+ class_device_destroy(mga_vid_class, MKDEV(mga_vid_major, 0));
+ class_destroy(mga_vid_class);
+
//FIXME turn off BES
cdev_del(mga_vid_cdev);
unregister_chrdev_region(mga_cdev_handle, mga_cards_num);
More information about the MPlayer-matrox
mailing list