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 
  22 /*
  23  * note that you can remove any or all of the drivers by undefining
  24  * the minor values in <linux/mouse.h>
  25  */
  26 extern struct file_operations bus_mouse_fops;
  27 extern struct file_operations psaux_fops;
  28 extern struct file_operations ms_bus_mouse_fops;
  29 extern struct file_operations atixl_busmouse_fops;
  30 
  31 extern unsigned long bus_mouse_init(unsigned long);
  32 extern unsigned long psaux_init(unsigned long);
  33 extern unsigned long ms_bus_mouse_init(unsigned long);
  34 extern unsigned long atixl_busmouse_init(unsigned long);
  35 
  36 static int mouse_open(struct inode * inode, struct file * file)
     /* [previous][next][first][last][top][bottom][index][help] */
  37 {
  38         int minor = MINOR(inode->i_rdev);
  39 
  40         switch (minor) {
  41 #ifdef CONFIG_BUSMOUSE
  42                 case BUSMOUSE_MINOR:
  43                         file->f_op = &bus_mouse_fops;
  44                         break;
  45 #endif
  46 #ifdef CONFIG_PSMOUSE
  47                 case PSMOUSE_MINOR:
  48                         file->f_op = &psaux_fops;
  49                         break;
  50 #endif
  51 #ifdef CONFIG_MS_BUSMOUSE
  52                 case MS_BUSMOUSE_MINOR:
  53                         file->f_op = &ms_bus_mouse_fops;
  54                         break;
  55 #endif
  56 #ifdef CONFIG_ATIXL_BUSMOUSE
  57                 case ATIXL_BUSMOUSE_MINOR:
  58                         file->f_op = &atixl_busmouse_fops;
  59                         break;
  60 #endif
  61                 default:
  62                         return -ENODEV;
  63         }
  64         return file->f_op->open(inode,file);
  65 }
  66 
  67 static struct file_operations mouse_fops = {
  68         NULL,           /* seek */
  69         NULL,           /* read */
  70         NULL,           /* write */
  71         NULL,           /* readdir */
  72         NULL,           /* select */
  73         NULL,           /* ioctl */
  74         NULL,           /* mmap */
  75         mouse_open,
  76         NULL            /* release */
  77 };
  78 
  79 unsigned long mouse_init(unsigned long kmem_start)
     /* [previous][next][first][last][top][bottom][index][help] */
  80 {
  81 #ifdef CONFIG_BUSMOUSE
  82         kmem_start = bus_mouse_init(kmem_start);
  83 #endif
  84 #ifdef CONFIG_PSMOUSE
  85         kmem_start = psaux_init(kmem_start);
  86 #endif
  87 #ifdef CONFIG_MS_BUSMOUSE
  88         kmem_start = ms_bus_mouse_init(kmem_start);
  89 #endif
  90 #ifdef CONFIG_ATIXL_BUSMOUSE
  91         kmem_start = atixl_busmouse_init(kmem_start);
  92 #endif
  93         chrdev_fops[10] = &mouse_fops;
  94         return kmem_start;
  95 }

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