VirtualBox

source: vbox/trunk/src/VBox/Main/testcase/tstUSBLinux.h@ 100841

Last change on this file since 100841 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/* $Id: tstUSBLinux.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VirtualBox USB Proxy Service class, test version for Linux hosts.
4 */
5
6/*
7 * Copyright (C) 2008-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_SRC_testcase_tstUSBLinux_h
29#define MAIN_INCLUDED_SRC_testcase_tstUSBLinux_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34typedef int HRESULT;
35enum { S_OK = 0, E_NOTIMPL = 1 };
36
37#include <VBox/usb.h>
38#include <VBox/usbfilter.h>
39
40#include <VBox/err.h>
41
42#ifdef VBOX_USB_WITH_SYSFS
43# include <libhal.h>
44#endif
45
46#include <stdio.h>
47/**
48 * The Linux hosted USB Proxy Service.
49 */
50class USBProxyServiceLinux
51{
52public:
53 USBProxyServiceLinux()
54 : mLastError(VINF_SUCCESS)
55 {}
56
57 HRESULT initSysfs(void);
58 PUSBDEVICE getDevicesFromSysfs(void);
59 int getLastError(void)
60 {
61 return mLastError;
62 }
63
64private:
65 int start(void) { return VINF_SUCCESS; }
66 static void freeDevice(PUSBDEVICE) {} /* We don't care about leaks in a test. */
67 int usbProbeInterfacesFromLibhal(const char *pszHalUuid, PUSBDEVICE pDev);
68 int mLastError;
69# ifdef VBOX_USB_WITH_SYSFS
70 /** Our connection to DBus for getting information from hal. This will be
71 * NULL if the initialisation failed. */
72 DBusConnection *mDBusConnection;
73 /** Handle to libhal. */
74 LibHalContext *mLibHalContext;
75# endif
76};
77
78#endif /* !MAIN_INCLUDED_SRC_testcase_tstUSBLinux_h */
79
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette