Changeset 32142 in vbox for trunk/src/VBox/Main/include/HostHardwareLinux.h
- Timestamp:
- Aug 31, 2010 1:00:46 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/HostHardwareLinux.h
r31652 r32142 110 110 111 111 112 /** Vector type for the list of interfaces. */113 #define VECTOR_TYPE char *114 #define VECTOR_TYPENAME USBInterfaceList115 static inline void USBInterfaceListCleanup(char **ppsz)116 {117 RTStrFree(*ppsz);118 }119 #define VECTOR_DESTRUCTOR USBInterfaceListCleanup120 #include "vector.h"121 122 112 /** Structure describing a host USB device */ 123 113 typedef struct USBDeviceInfo … … 128 118 * method. */ 129 119 char *mSysfsPath; 130 /** Type for the list of interfaces. */131 USBInterfaceListmInterfaces;120 /** List of interfaces. Only one simulaneous traversal is possible. */ 121 struct USBInterfaceList *mInterfaces; 132 122 } USBDeviceInfo; 133 123 134 135 124 /** Destructor. */ 136 static inline void USBDevInfoCleanup(USBDeviceInfo *pSelf) 137 { 138 RTStrFree(pSelf->mDevice); 139 RTStrFree(pSelf->mSysfsPath); 140 pSelf->mDevice = pSelf->mSysfsPath = NULL; 141 USBInterfaceList_cleanup(&pSelf->mInterfaces); 142 } 143 125 void USBDevInfoCleanup(USBDeviceInfo *pSelf); 144 126 145 127 /** Constructor - the strings will be duplicated. */ 146 static inline int USBDevInfoInit(USBDeviceInfo *pSelf, const char *aDevice, 147 const char *aSystemID) 148 { 149 pSelf->mDevice = aDevice ? RTStrDup(aDevice) : NULL; 150 pSelf->mSysfsPath = aSystemID ? RTStrDup(aSystemID) : NULL; 151 if ( !USBInterfaceList_init(&pSelf->mInterfaces) 152 || (aDevice && !pSelf->mDevice) || (aSystemID && ! pSelf->mSysfsPath)) 153 { 154 USBDevInfoCleanup(pSelf); 155 return 0; 156 } 157 return 1; 158 } 128 int USBDevInfoInit(USBDeviceInfo *pSelf, const char *aDevice, 129 const char *aSystemID); 130 131 /** 132 * Return the first in a list of USB device interfaces (that is, its sysfs 133 * path), or NULL if there are none. 134 */ 135 char *USBDevInfoFirstInterface(struct USBInterfaceList *pInterfaces); 136 137 /** 138 * Return the next in a list of USB device interfaces (that is, its sysfs 139 * path), or NULL if there are none. 140 */ 141 char *USBDevInfoNextInterface(struct USBInterfaceList *pInterfaces); 159 142 160 143 … … 195 178 */ 196 179 int USBDevInfoUpdateDevices(VBoxMainUSBDeviceInfo *pSelf); 197 198 180 199 181 /** Get the first element in the list of USB devices. */
Note:
See TracChangeset
for help on using the changeset viewer.