1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31#define __NO_VERSION__
32#include "comedidev.h"
33#include "comedi_fops.h"
34#include <linux/proc_fs.h>
35#include <linux/string.h>
36
37#ifdef CONFIG_PROC_FS
38static int comedi_read(char *buf, char **start, off_t offset, int len,
39 int *eof, void *data)
40{
41 int i;
42 int devices_q = 0;
43 int l = 0;
44 struct comedi_driver *driv;
45
46 l += sprintf(buf + l,
47 "comedi version " COMEDI_RELEASE "\n"
48 "format string: %s\n",
49 "\"%2d: %-20s %-20s %4d\", i, "
50 "driver_name, board_name, n_subdevices");
51
52 for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
53 struct comedi_device_file_info *dev_file_info =
54 comedi_get_device_file_info(i);
55 struct comedi_device *dev;
56
57 if (dev_file_info == NULL)
58 continue;
59 dev = dev_file_info->device;
60
61 if (dev->attached) {
62 devices_q = 1;
63 l += sprintf(buf + l, "%2d: %-20s %-20s %4d\n",
64 i,
65 dev->driver->driver_name,
66 dev->board_name, dev->n_subdevices);
67 }
68 }
69 if (!devices_q)
70 l += sprintf(buf + l, "no devices\n");
71
72 for (driv = comedi_drivers; driv; driv = driv->next) {
73 l += sprintf(buf + l, "%s:\n", driv->driver_name);
74 for (i = 0; i < driv->num_names; i++) {
75 l += sprintf(buf + l, " %s\n",
76 *(char **)((char *)driv->board_name +
77 i * driv->offset));
78 }
79 if (!driv->num_names)
80 l += sprintf(buf + l, " %s\n", driv->driver_name);
81 }
82
83 return l;
84}
85
86void comedi_proc_init(void)
87{
88 struct proc_dir_entry *comedi_proc;
89
90 comedi_proc = create_proc_entry("comedi", S_IFREG | S_IRUGO, NULL);
91 if (comedi_proc)
92 comedi_proc->read_proc = comedi_read;
93}
94
95void comedi_proc_cleanup(void)
96{
97 remove_proc_entry("comedi", NULL);
98}
99#endif
100