VirtualBox

source: vbox/trunk/src/VBox/Main/include/USBGetDevices.h@ 32324

Last change on this file since 32324 was 32324, checked in by vboxsync, 14 years ago

Main/USBProxyServiceLinux: split out USB enumeration from USBProxyServiceLinux.cpp and HostHardwareLinux.cpp into a separate file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/* $Id: USBGetDevices.h 32324 2010-09-08 15:43:32Z vboxsync $ */
2/** @file
3 * VirtualBox Linux host USB device enumeration.
4 */
5
6/*
7 * Copyright (C) 2006-2010 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#ifndef ___USBGetDevices_h
19# define ___USBGetDevices_h
20
21#include <VBox/usb.h>
22#include <iprt/mem.h>
23#include <iprt/string.h>
24
25/**
26 * Free all the members of a USB device created by the Linux enumeration code.
27 * @note this duplicates a USBProxyService method which we needed access too
28 * without pulling in the rest of the proxy service code.
29 *
30 * @param pDevice Pointer to the device.
31 */
32static inline void deviceFreeMembers(PUSBDEVICE pDevice)
33{
34 RTStrFree((char *)pDevice->pszManufacturer);
35 pDevice->pszManufacturer = NULL;
36 RTStrFree((char *)pDevice->pszProduct);
37 pDevice->pszProduct = NULL;
38 RTStrFree((char *)pDevice->pszSerialNumber);
39 pDevice->pszSerialNumber = NULL;
40
41 RTStrFree((char *)pDevice->pszAddress);
42 pDevice->pszAddress = NULL;
43}
44
45/**
46 * Free one USB device created by the Linux enumeration code.
47 * @note this duplicates a USBProxyService method which we needed access too
48 * without pulling in the rest of the proxy service code.
49 *
50 * @param pDevice Pointer to the device.
51 */
52static inline void deviceFree(PUSBDEVICE pDevice)
53{
54 deviceFreeMembers(pDevice);
55 RTMemFree(pDevice);
56}
57
58/**
59 * Check whether @a pcszDevices is a valid usbfs devices file for checking
60 * whether usbfs is supported or not.
61 * @returns VINF_SUCCESS if it is
62 * @returns VERR_NOT_FOUND if it isn't
63 * @returns iprt status code if an error occurred
64 * @todo test whether USB with sysfs/dev is supported
65 */
66extern int USBProxyLinuxCheckForUsbfs(const char *pcszDevices);
67
68/**
69 * Get the list of USB devices supported by the system. Should be freed using
70 * @a deviceFree or something equivalent.
71 * @param pcszUsbfsRoot the path to usbfs, or NULL to use sysfs
72 */
73extern PUSBDEVICE USBProxyLinuxGetDevices(const char *pcszUsbfsRoot);
74
75#endif /* ___USBGetDevices_h */
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