-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
devtag-allinone.h
82 lines (66 loc) · 1.79 KB
/
devtag-allinone.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef DEVTAG_H
#define DEVTAG_H
#include <sys/types.h>
/*
* Lookup 'devtag' among the predefined device selections.
* If a matching device is found return the name of this device in buf.
*
* If 'devtag' is prefixed with "/dev/" then the result is also
* prefixed with "/dev/".
*
* Returns number of devices found or a negative value if an error occured.
*/
int devtag_lookup(char *buf, size_t bufsize, const char *devtag);
/* also returns a constant name if supplied in the configuration */
int devtag_lookup2(char *buf, size_t bufsize, char *constbuf, size_t constsize, const char *devtag);
/*
* Simple lookup.
* Returns a suitable replacement for devtag.
* If no replacement can be determined a 'devtag' will be returned as a duplicated string.
*/
char *devtag_get(const char *devtag);
#endif
#ifndef LIBDEVTAG_H
#define LIBDEVTAG_H
#define LIBDEVTAG_VERSION "1.0.6"
struct devname;
struct devname_head {
struct devname *head;
};
struct devname {
char *dev;
char *devname;
char *type;
int pos;
struct devname *next;
};
struct devinfo;
struct devinfo_head {
struct devinfo *head;
};
struct devinfo {
const char *name;
const char *value;
struct devinfo *next;
};
struct dev;
struct dev_head {
struct dev *head;
};
struct dev {
struct devinfo_head info;
struct devname_head devnames;
char *class; /* "usb", "pci" etc */
struct dev *next;
};
/*
* Find devices matching selections in list 'sel' (of type struct dev_info).
* Put matching devices in result list 'result'.
*/
int devtag_dev_scan(struct dev_head *result, const struct devinfo_head *sel);
/*
* Find USB devices matching selections in list 'sel' (of type struct dev_info).
* Put matching USB devices in result list 'result'.
*/
int devtag_usb_scan(struct dev_head *result, const struct devinfo_head *sel);
#endif