File: devtree.h

package info (click to toggle)
usbutils 0.87-5squeeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,088 kB
  • ctags: 354
  • sloc: ansic: 4,589; sh: 1,201; makefile: 145
file content (89 lines) | stat: -rw-r--r-- 2,827 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
82
83
84
85
86
87
88
89
/*****************************************************************************/

/*
 *      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.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  Please note that the GPL allows you to use the driver, NOT the radio.
 *  In order to use the radio, you need a license from the communications
 *  authority of your country.
 *
 */

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

#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(void);

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

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