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 innotek GmbH
|
---|
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 |
|
---|
27 | #ifndef ___VBox_usblib_h
|
---|
28 | #define ___VBox_usblib_h
|
---|
29 |
|
---|
30 | #include <VBox/cdefs.h>
|
---|
31 | #include <VBox/types.h>
|
---|
32 | #include <VBox/usb.h>
|
---|
33 |
|
---|
34 | #ifdef RT_OS_WINDOWS
|
---|
35 | # include <VBox/usblib-win.h>
|
---|
36 | #endif
|
---|
37 | #ifdef RT_OS_DARWIN
|
---|
38 | # include <VBox/usblib-darwin.h>
|
---|
39 | #endif
|
---|
40 | /** @todo merge the usblib-win.h interface into the darwin and linux ports where suitable. */
|
---|
41 |
|
---|
42 | /** @defgroup grp_USBLib USBLib - USB Support Library
|
---|
43 | * This module implements the basic low-level OS interfaces and common USB code.
|
---|
44 | * @{
|
---|
45 | */
|
---|
46 |
|
---|
47 | #ifndef RT_OS_WINDOWS
|
---|
48 | #ifdef IN_RING3
|
---|
49 | /**
|
---|
50 | * Initializes the USBLib component.
|
---|
51 | *
|
---|
52 | * The USBLib keeps a per process connection to the kernel driver
|
---|
53 | * and all USBLib users within a process will share the same
|
---|
54 | * connection. USBLib does reference counting to make sure that
|
---|
55 | * the connection remains open until all users has called USBLibTerm().
|
---|
56 | *
|
---|
57 | * @returns VBox status code.
|
---|
58 | *
|
---|
59 | * @remark The users within the process are responsible for not calling
|
---|
60 | * this function at the same time (because I'm lazy).
|
---|
61 | */
|
---|
62 | int USBLibInit(void);
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Terminates the USBLib component.
|
---|
66 | *
|
---|
67 | * Must match successfull USBLibInit calls.
|
---|
68 | *
|
---|
69 | * @returns VBox status code.
|
---|
70 | */
|
---|
71 | int USBLibTerm(void);
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Adds a filter.
|
---|
75 | *
|
---|
76 | * This function will validate and transfer the specified filter
|
---|
77 | * to the kernel driver and make it start using it. The kernel
|
---|
78 | * driver will return a filter id that this function passes on
|
---|
79 | * to its caller.
|
---|
80 | *
|
---|
81 | * The kernel driver will associate the added filter with the
|
---|
82 | * calling process and automatically remove all filters when
|
---|
83 | * the process terminates the connection to it or dies.
|
---|
84 | *
|
---|
85 | * @returns Filter id for passing to USBLibRemoveFilter on success.
|
---|
86 | * @returns NULL on failure.
|
---|
87 | *
|
---|
88 | * @param pFilter The filter to add.
|
---|
89 | */
|
---|
90 | void *USBLibAddFilter(PCUSBFILTER pFilter);
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * Removes a filter.
|
---|
94 | *
|
---|
95 | * @param pvId The ID returned by USBLibAddFilter.
|
---|
96 | */
|
---|
97 | void USBLibRemoveFilter(void *pvId);
|
---|
98 |
|
---|
99 | #endif /* IN_RING3 */
|
---|
100 | #endif /* !RT_OS_WINDOWS */
|
---|
101 |
|
---|
102 | /** @} */
|
---|
103 | #endif
|
---|
104 |
|
---|