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