tizen 2.3.1 release
[framework/system/usbutils.git] / devtree.h
1 /*****************************************************************************/
2
3 /*
4  *      devtree.h  --  USB device tree.
5  *
6  *      Copyright (C) 1999 Thomas Sailer, sailer@ife.ee.ethz.ch
7  *
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.
12  *
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.
17  *
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.
21  *
22  *  Please note that the GPL allows you to use the driver, NOT the radio.
23  *  In order to use the radio, you need a license from the communications
24  *  authority of your country.
25  *
26  */
27
28 /*****************************************************************************/
29
30 #ifndef _DEVTREE_H
31 #define _DEVTREE_H
32
33 /* ---------------------------------------------------------------------- */
34
35 #ifdef HAVE_CONFIG_H
36 #include "config.h"
37 #endif
38
39 #include "list.h"
40
41 /* ---------------------------------------------------------------------- */
42
43 #define USBFLG_DELETED    1
44 #define USBFLG_NEW        2
45
46 /* ---------------------------------------------------------------------- */
47
48 struct usbbusnode {
49         struct list_head list;
50         struct list_head childlist;
51         unsigned int flags;
52
53         unsigned int busnum;
54 };
55
56 struct usbdevnode {
57         struct list_head list;
58         struct list_head childlist;
59         unsigned int flags;
60
61         struct usbbusnode *bus;
62         struct usbdevnode *parent;
63
64         unsigned int devnum;
65         unsigned int vendorid;
66         unsigned int productid;
67 };
68
69 extern struct list_head usbbuslist;
70
71 /* ---------------------------------------------------------------------- */
72
73 extern void devtree_markdeleted(void);
74 extern struct usbbusnode *devtree_findbus(unsigned int busn);
75 extern struct usbdevnode *devtree_finddevice(struct usbbusnode *bus, unsigned int devn);
76 extern void devtree_parsedevfile(int fd);
77 extern void devtree_busconnect(struct usbbusnode *bus);
78 extern void devtree_busdisconnect(struct usbbusnode *bus);
79 extern void devtree_devconnect(struct usbdevnode *dev);
80 extern void devtree_devdisconnect(struct usbdevnode *dev);
81 extern void devtree_processchanges(void);
82 extern void devtree_dump(void);
83
84 extern int lprintf(unsigned int vl, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
85
86 /* ---------------------------------------------------------------------- */
87 #endif /* _DEVTREE_H */