File: devtree.h

package info (click to toggle)
usbutils 1%3A005-3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,416 kB
  • sloc: sh: 11,229; ansic: 6,939; python: 433; makefile: 185
file content (81 lines) | stat: -rw-r--r-- 2,452 bytes parent folder | download
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
/*****************************************************************************/

/*
 *      devtree.h  --  USB device tree.
 *
 *      Copyright (C) 1999 Thomas Sailer, sailer@ife.ee.ethz.ch
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 */

/*****************************************************************************/

#ifndef _DEVTREE_H
#define _DEVTREE_H

/* ---------------------------------------------------------------------- */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "list.h"

/* ---------------------------------------------------------------------- */

#define USBFLG_DELETED    1
#define USBFLG_NEW        2

/* ---------------------------------------------------------------------- */

struct usbbusnode {
	struct list_head list;
	struct list_head childlist;
	unsigned int flags;

	unsigned int busnum;
};

struct usbdevnode {
	struct list_head list;
	struct list_head childlist;
	unsigned int flags;

	struct usbbusnode *bus;
	struct usbdevnode *parent;

	unsigned int devnum;
	unsigned int vendorid;
	unsigned int productid;
};

extern struct list_head usbbuslist;

/* ---------------------------------------------------------------------- */

extern void devtree_markdeleted(void);
extern struct usbbusnode *devtree_findbus(unsigned int busn);
extern struct usbdevnode *devtree_finddevice(struct usbbusnode *bus,
					     unsigned int devn);
extern void devtree_parsedevfile(int fd);
extern void devtree_busconnect(struct usbbusnode *bus);
extern void devtree_busdisconnect(struct usbbusnode *bus);
extern void devtree_devconnect(struct usbdevnode *dev);
extern void devtree_devdisconnect(struct usbdevnode *dev);
extern void devtree_processchanges(void);
extern void devtree_dump(unsigned int verblevel);

extern int lprintf(unsigned int vl, const char *format, ...)
	__attribute__ ((format (printf, 2, 3)));

/* ---------------------------------------------------------------------- */
#endif /* _DEVTREE_H */