1 | /** @file
|
---|
2 | * USBLIB - USB Support Library.
|
---|
3 | * This module implements the basic low-level OS interfaces.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | *
|
---|
26 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
27 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
28 | * additional information or have any questions.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #ifndef ___VBox_usblib_h
|
---|
32 | #define ___VBox_usblib_h
|
---|
33 |
|
---|
34 | #include <VBox/cdefs.h>
|
---|
35 | #include <VBox/types.h>
|
---|
36 | #include <VBox/usb.h>
|
---|
37 |
|
---|
38 | #ifdef RT_OS_WINDOWS
|
---|
39 | # include <VBox/usblib-win.h>
|
---|
40 | #endif
|
---|
41 | #ifdef RT_OS_SOLARIS
|
---|
42 | # include <VBox/usblib-solaris.h>
|
---|
43 | #endif
|
---|
44 | #ifdef RT_OS_DARWIN
|
---|
45 | # include <VBox/usblib-darwin.h>
|
---|
46 | #endif
|
---|
47 | /** @todo merge the usblib-win.h interface into the darwin and linux ports where suitable. */
|
---|
48 |
|
---|
49 | /** @defgroup grp_USBLib USBLib - USB Support Library
|
---|
50 | * This module implements the basic low-level OS interfaces and common USB code.
|
---|
51 | * @{
|
---|
52 | */
|
---|
53 |
|
---|
54 | #ifndef RT_OS_WINDOWS
|
---|
55 | #ifdef IN_RING3
|
---|
56 | /**
|
---|
57 | * Initializes the USBLib component.
|
---|
58 | *
|
---|
59 | * The USBLib keeps a per process connection to the kernel driver
|
---|
60 | * and all USBLib users within a process will share the same
|
---|
61 | * connection. USBLib does reference counting to make sure that
|
---|
62 | * the connection remains open until all users has called USBLibTerm().
|
---|
63 | *
|
---|
64 | * @returns VBox status code.
|
---|
65 | *
|
---|
66 | * @remark The users within the process are responsible for not calling
|
---|
67 | * this function at the same time (because I'm lazy).
|
---|
68 | */
|
---|
69 | int USBLibInit(void);
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Terminates the USBLib component.
|
---|
73 | *
|
---|
74 | * Must match successfull USBLibInit calls.
|
---|
75 | *
|
---|
76 | * @returns VBox status code.
|
---|
77 | */
|
---|
78 | int USBLibTerm(void);
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Adds a filter.
|
---|
82 | *
|
---|
83 | * This function will validate and transfer the specified filter
|
---|
84 | * to the kernel driver and make it start using it. The kernel
|
---|
85 | * driver will return a filter id that this function passes on
|
---|
86 | * to its caller.
|
---|
87 | *
|
---|
88 | * The kernel driver will associate the added filter with the
|
---|
89 | * calling process and automatically remove all filters when
|
---|
90 | * the process terminates the connection to it or dies.
|
---|
91 | *
|
---|
92 | * @returns Filter id for passing to USBLibRemoveFilter on success.
|
---|
93 | * @returns NULL on failure.
|
---|
94 | *
|
---|
95 | * @param pFilter The filter to add.
|
---|
96 | */
|
---|
97 | void *USBLibAddFilter(PCUSBFILTER pFilter);
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Removes a filter.
|
---|
101 | *
|
---|
102 | * @param pvId The ID returned by USBLibAddFilter.
|
---|
103 | */
|
---|
104 | void USBLibRemoveFilter(void *pvId);
|
---|
105 |
|
---|
106 | #endif /* IN_RING3 */
|
---|
107 | #endif /* !RT_OS_WINDOWS */
|
---|
108 |
|
---|
109 | /** @} */
|
---|
110 | #endif
|
---|
111 |
|
---|