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