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 #define __NO_VERSION__
32 #include "comedidev.h"
33 #include <linux/proc_fs.h>
34 //#include <linux/string.h>
36 int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
37 int *eof, void *data);
39 extern comedi_driver *comedi_drivers;
41 int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
50 "comedi version " COMEDI_RELEASE "\n"
51 "format string: %s\n",
52 "\"%2d: %-20s %-20s %4d\",i,driver_name,board_name,n_subdevices");
54 for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
55 struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(i);
58 if(dev_file_info == NULL) continue;
59 dev = dev_file_info->device;
63 l += sprintf(buf + l, "%2d: %-20s %-20s %4d\n",
65 dev->driver->driver_name,
66 dev->board_name, dev->n_subdevices);
70 l += sprintf(buf + l, "no devices\n");
73 for (driv = comedi_drivers; driv; driv = driv->next) {
74 l += sprintf(buf + l, "%s:\n", driv->driver_name);
75 for (i = 0; i < driv->num_names; i++) {
76 l += sprintf(buf + l, " %s\n",
77 *(char **)((char *)driv->board_name +
80 if (!driv->num_names) {
81 l += sprintf(buf + l, " %s\n", driv->driver_name);
89 void comedi_proc_init(void)
91 struct proc_dir_entry *comedi_proc;
93 comedi_proc = create_proc_entry("comedi", S_IFREG | S_IRUGO, 0);
95 comedi_proc->read_proc = comedi_read_procmem;
98 void comedi_proc_cleanup(void)
100 remove_proc_entry("comedi", 0);