3 /proc interface for comedi
5 COMEDI - Linux Control and Measurement Device Interface
6 Copyright (C) 1998 David A. Schleef <ds@schleef.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 This is some serious bloatware.
27 Taken from Dave A.'s PCL-711 driver, 'cuz I thought it
31 #include "comedidev.h"
32 #include "comedi_internal.h"
33 #include <linux/proc_fs.h>
34 #include <linux/seq_file.h>
36 static int comedi_read(struct seq_file *m, void *v)
40 struct comedi_driver *driv;
43 "comedi version " COMEDI_RELEASE "\n"
44 "format string: %s\n",
45 "\"%2d: %-20s %-20s %4d\", i, "
46 "driver_name, board_name, n_subdevices");
48 for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
49 struct comedi_device *dev = comedi_dev_from_minor(i);
55 seq_printf(m, "%2d: %-20s %-20s %4d\n",
56 i, dev->driver->driver_name,
57 dev->board_name, dev->n_subdevices);
61 seq_puts(m, "no devices\n");
63 for (driv = comedi_drivers; driv; driv = driv->next) {
64 seq_printf(m, "%s:\n", driv->driver_name);
65 for (i = 0; i < driv->num_names; i++)
66 seq_printf(m, " %s\n",
67 *(char **)((char *)driv->board_name +
71 seq_printf(m, " %s\n", driv->driver_name);
78 * seq_file wrappers for procfile show routines.
80 static int comedi_proc_open(struct inode *inode, struct file *file)
82 return single_open(file, comedi_read, NULL);
85 static const struct file_operations comedi_proc_fops = {
86 .open = comedi_proc_open,
89 .release = single_release,
92 void comedi_proc_init(void)
94 proc_create("comedi", 0644, NULL, &comedi_proc_fops);
97 void comedi_proc_cleanup(void)
99 remove_proc_entry("comedi", NULL);