1 | /* $Id $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox USB Proxy Service class, test version for Linux hosts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008 Oracle Corporation
|
---|
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 |
|
---|
18 |
|
---|
19 | #ifndef ____H_TSTUSBLINUX
|
---|
20 | #define ____H_TSTUSBLINUX
|
---|
21 |
|
---|
22 | typedef int HRESULT;
|
---|
23 | enum { S_OK = 0, E_NOTIMPL = 1 };
|
---|
24 |
|
---|
25 | #include <VBox/usb.h>
|
---|
26 | #include <VBox/usbfilter.h>
|
---|
27 |
|
---|
28 | #include <VBox/err.h>
|
---|
29 |
|
---|
30 | #ifdef VBOX_USB_WITH_SYSFS
|
---|
31 | # include <libhal.h>
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <stdio.h>
|
---|
35 | /**
|
---|
36 | * The Linux hosted USB Proxy Service.
|
---|
37 | */
|
---|
38 | class USBProxyServiceLinux
|
---|
39 | {
|
---|
40 | public:
|
---|
41 | USBProxyServiceLinux() : mLastError(VINF_SUCCESS) {}
|
---|
42 | HRESULT initSysfs(void);
|
---|
43 | PUSBDEVICE getDevicesFromSysfs(void);
|
---|
44 | int getLastError(void) { return mLastError; }
|
---|
45 |
|
---|
46 | private:
|
---|
47 | int start(void) { return VINF_SUCCESS; }
|
---|
48 | static void freeDevice(PUSBDEVICE) {} /* We don't care about leaks in a test. */
|
---|
49 | int usbProbeInterfacesFromLibhal(const char *pszHalUuid, PUSBDEVICE pDev);
|
---|
50 | int mLastError;
|
---|
51 | # ifdef VBOX_USB_WITH_SYSFS
|
---|
52 | /** Our connection to DBus for getting information from hal. This will be
|
---|
53 | * NULL if the initialisation failed. */
|
---|
54 | DBusConnection *mDBusConnection;
|
---|
55 | /** Handle to libhal. */
|
---|
56 | LibHalContext *mLibHalContext;
|
---|
57 | # endif
|
---|
58 | };
|
---|
59 |
|
---|
60 | #endif /* !____H_TSTUSBLINUX */
|
---|
61 |
|
---|