Changeset 60089 in vbox for trunk/src/VBox/Main/src-server/linux
- Timestamp:
- Mar 18, 2016 10:51:02 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106086
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/linux/USBProxyBackendLinux.cpp
r60068 r60089 60 60 * Initialize data members. 61 61 */ 62 USBProxyBackendLinux::USBProxyBackendLinux(USBProxyService *aUsbProxyService) 63 : USBProxyBackend(aUsbProxyService), mhFile(NIL_RTFILE), mhWakeupPipeR(NIL_RTPIPE), 64 mhWakeupPipeW(NIL_RTPIPE), mUsingUsbfsDevices(true /* see init */), 65 mUdevPolls(0), mpWaiter(NULL) 66 { 67 LogFlowThisFunc(("aUsbProxyService=%p\n", aUsbProxyService)); 62 USBProxyBackendLinux::USBProxyBackendLinux() 63 : USBProxyBackend(), mhWakeupPipeR(NIL_RTPIPE), mhWakeupPipeW(NIL_RTPIPE) 64 { 65 LogFlowThisFunc(("\n")); 66 } 67 68 69 /** 70 * Stop all service threads and free the device chain. 71 */ 72 USBProxyBackendLinux::~USBProxyBackendLinux() 73 { 74 LogFlowThisFunc(("\n")); 68 75 } 69 76 … … 73 80 * @returns VBox status code. 74 81 */ 75 int USBProxyBackendLinux::init(void) 76 { 82 int USBProxyBackendLinux::init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress) 83 { 84 USBProxyBackend::init(pUsbProxyService, strId, strAddress); 85 77 86 const char *pcszDevicesRoot; 78 87 int rc = USBProxyLinuxChooseMethod(&mUsingUsbfsDevices, &pcszDevicesRoot); … … 88 97 89 98 return rc; 99 } 100 101 void USBProxyBackendLinux::uninit() 102 { 103 /* 104 * Stop the service. 105 */ 106 if (isActive()) 107 stop(); 108 109 /* 110 * Free resources. 111 */ 112 doUsbfsCleanupAsNeeded(); 113 #ifdef VBOX_USB_WITH_SYSFS 114 if (mpWaiter) 115 delete mpWaiter; 116 #endif 117 118 USBProxyBackend::uninit(); 90 119 } 91 120 … … 179 208 180 209 /** 181 * Stop all service threads and free the device chain.182 */183 USBProxyBackendLinux::~USBProxyBackendLinux()184 {185 LogFlowThisFunc(("\n"));186 187 /*188 * Stop the service.189 */190 if (isActive())191 stop();192 193 /*194 * Free resources.195 */196 doUsbfsCleanupAsNeeded();197 #ifdef VBOX_USB_WITH_SYSFS198 if (mpWaiter)199 delete mpWaiter;200 #endif201 }202 203 204 /**205 210 * If any Usbfs-related resources are currently allocated, then free them 206 211 * and mark them as freed. … … 211 216 * Free resources. 212 217 */ 213 RTFileClose(mhFile); 218 if (mhFile != NIL_RTFILE) 219 RTFileClose(mhFile); 214 220 mhFile = NIL_RTFILE; 215 221 216 RTPipeClose(mhWakeupPipeR); 217 RTPipeClose(mhWakeupPipeW); 222 if (mhWakeupPipeR != NIL_RTPIPE) 223 RTPipeClose(mhWakeupPipeR); 224 if (mhWakeupPipeW != NIL_RTPIPE) 225 RTPipeClose(mhWakeupPipeW); 218 226 mhWakeupPipeW = mhWakeupPipeR = NIL_RTPIPE; 219 227 }
Note:
See TracChangeset
for help on using the changeset viewer.