root/kernel/chr_drv/mouse.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. mouse_open
  2. mouse_init

   1 /*
   2  * linux/kernel/chr_drv/mouse.c
   3  *
   4  * Generic mouse open routine by Johan Myreen
   5  *
   6  * Based on code from Linus
   7  *
   8  * Teemu Rantanen's Microsoft Busmouse support and Derrick Cole's
   9  *   changes incorporated into 0.97pl4
  10  *   by Peter Cervasio (pete%q106fm.uucp@wupost.wustl.edu) (08SEP92)
  11  *   See busmouse.c for particulars.
  12  *
  13  * Made things a lot mode modular - easy to compile in just one or two
  14  * of the mouse drivers, as they are now completely independent. Linus.
  15  */
  16 
  17 #include <linux/fs.h>
  18 #include <linux/errno.h>
  19 #include <linux/mouse.h>
  20 #include <linux/config.h>
  21 #include <linux/kernel.h>
  22 
  23 /*
  24  * note that you can remove any or all of the drivers by undefining
  25  * the minor values in <linux/mouse.h>
  26  */
  27 extern struct file_operations bus_mouse_fops;
  28 extern struct file_operations psaux_fops;
  29 extern struct file_operations ms_bus_mouse_fops;
  30 extern struct file_operations atixl_busmouse_fops;
  31 
  32 extern unsigned long bus_mouse_init(unsigned long);
  33 extern unsigned long psaux_init(unsigned long);
  34 extern unsigned long ms_bus_mouse_init(unsigned long);
  35 extern unsigned long atixl_busmouse_init(unsigned long);
  36 
  37 static int mouse_open(struct inode * inode, struct file * file)
     /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39         int minor = MINOR(inode->i_rdev);
  40 
  41         switch (minor) {
  42 #ifdef CONFIG_BUSMOUSE
  43                 case BUSMOUSE_MINOR:
  44                         file->f_op = &bus_mouse_fops;
  45                         break;
  46 #endif
  47 #ifdef CONFIG_PSMOUSE
  48                 case PSMOUSE_MINOR:
  49                         file->f_op = &psaux_fops;
  50                         break;
  51 #endif
  52 #ifdef CONFIG_MS_BUSMOUSE
  53                 case MS_BUSMOUSE_MINOR:
  54                         file->f_op = &ms_bus_mouse_fops;
  55                         break;
  56 #endif
  57 #ifdef CONFIG_ATIXL_BUSMOUSE
  58                 case ATIXL_BUSMOUSE_MINOR:
  59                         file->f_op = &atixl_busmouse_fops;
  60                         break;
  61 #endif
  62                 default:
  63                         return -ENODEV;
  64         }
  65         return file->f_op->open(inode,file);
  66 }
  67 
  68 static struct file_operations mouse_fops = {
  69         NULL,           /* seek */
  70         NULL,           /* read */
  71         NULL,           /* write */
  72         NULL,           /* readdir */
  73         NULL,           /* select */
  74         NULL,           /* ioctl */
  75         NULL,           /* mmap */
  76         mouse_open,
  77         NULL            /* release */
  78 };
  79 
  80 unsigned long mouse_init(unsigned long kmem_start)
     /* [previous][next][first][last][top][bottom][index][help] */
  81 {
  82 #ifdef CONFIG_BUSMOUSE
  83         kmem_start = bus_mouse_init(kmem_start);
  84 #endif
  85 #ifdef CONFIG_PSMOUSE
  86         kmem_start = psaux_init(kmem_start);
  87 #endif
  88 #ifdef CONFIG_MS_BUSMOUSE
  89         kmem_start = ms_bus_mouse_init(kmem_start);
  90 #endif
  91 #ifdef CONFIG_ATIXL_BUSMOUSE
  92         kmem_start = atixl_busmouse_init(kmem_start);
  93 #endif
  94         if (register_chrdev(10,"mouse",&mouse_fops))
  95                 printk("unable to get major 10 for mouse devices\n");
  96         return kmem_start;
  97 }

/* [previous][next][first][last][top][bottom][index][help] */