[MPlayer-matrox] r265 - in mga_vid/trunk: mga_vid.c mga_vid.h

attila subversion at mplayerhq.hu
Fri May 23 22:13:27 CEST 2008


Author: attila
Date: Fri May 23 22:13:27 2008
New Revision: 265

Log:
1) fix all ioctl command numbers to properly match the direction they are using
2) add MGA_VID_GET_VERSION ioctl
3) add capabilities field to the mga_vid_config struct
4) bump MGA_VID_VERSION up


Modified:
   mga_vid/trunk/mga_vid.c
   mga_vid/trunk/mga_vid.h

Modified: mga_vid/trunk/mga_vid.c
==============================================================================
--- mga_vid/trunk/mga_vid.c	(original)
+++ mga_vid/trunk/mga_vid.c	Fri May 23 22:13:27 2008
@@ -661,6 +661,14 @@ static int mga_vid_ioctl(struct inode *i
 	mga_card_t *card = (mga_card_t *) file->private_data;
 
 	switch (cmd) {
+	case MGA_VID_GET_VERSION:
+		tmp = MGA_VID_VERSION;
+		if (copy_to_user((uint32_t *) arg, &tmp, sizeof(uint32_t))) {
+			printk(KERN_ERR "mga_vid: failed copy %p to userspace %p\n", &tmp, (uint32_t *) arg);
+			return (-EFAULT);
+		}
+		break;
+
 	case MGA_VID_CONFIG:
 		if (copy_from_user (&card->config, (mga_vid_config_t *) arg, sizeof(mga_vid_config_t))) {
 			printk(KERN_ERR "mga_vid: failed copy from userspace\n");
@@ -739,7 +747,7 @@ static int mga_vid_ioctl(struct inode *i
 		break;
 
 	case MGA_VID_FSEL:
-		if (copy_from_user(&frame, (int *)arg, sizeof(int))) {
+		if (copy_from_user(&frame, (int *)arg, sizeof(uint32_t))) {
 			printk(KERN_ERR "mga_vid: FSEL failed copy from userspace\n");
 			return (-EFAULT);
 		}

Modified: mga_vid/trunk/mga_vid.h
==============================================================================
--- mga_vid/trunk/mga_vid.h	(original)
+++ mga_vid/trunk/mga_vid.h	Fri May 23 22:13:27 2008
@@ -33,6 +33,7 @@ uint8_t  colkey_blue;
 uint32_t format;
 uint32_t frame_size;
 uint32_t num_frames;
+uint32_t capabilities;
 } mga_vid_config_t;
 
 /* supported FOURCCs */
@@ -43,12 +44,13 @@ uint32_t num_frames;
 #define MGA_VID_FORMAT_UYVY (('U'<<24)|('Y'<<16)|('V'<<8)|'Y')
 
 /* ioctl commands */
-#define MGA_VID_CONFIG    _IOR('J', 1, mga_vid_config_t)
-#define MGA_VID_ON        _IO ('J', 2)
-#define MGA_VID_OFF       _IO ('J', 3)
-#define MGA_VID_FSEL _IOR('J', 4, int)
-#define MGA_VID_GET_LUMA _IOR('J', 5, int)
-#define MGA_VID_SET_LUMA _IOR('J', 6, int)
+#define MGA_VID_GET_VERSION  _IOR ('J', 1, uint32_t)
+#define MGA_VID_CONFIG       _IOWR('J', 2, mga_vid_config_t)
+#define MGA_VID_ON           _IO  ('J', 3)
+#define MGA_VID_OFF          _IO  ('J', 4)
+#define MGA_VID_FSEL         _IOW ('J', 5, uint32_t)
+#define MGA_VID_GET_LUMA     _IOR ('J', 6, uint32_t)
+#define MGA_VID_SET_LUMA     _IOW ('J', 7, uint32_t)
 
 /* card identifiers */
 #define MGA_G200 0x1234
@@ -58,6 +60,6 @@ uint32_t num_frames;
 #define MGA_G550 0xDEF0
 
 /* version of the mga_vid_config struct */
-#define MGA_VID_VERSION 0x0201
+#define MGA_VID_VERSION 0x0202
 
 #endif /* MGA_VID_H */



More information about the MPlayer-matrox mailing list