Changeset 50228 in vbox for trunk/src/VBox/Devices/USB/vrdp/USBProxyDevice-vrdp.cpp
- Timestamp:
- Jan 24, 2014 9:16:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/vrdp/USBProxyDevice-vrdp.cpp
r49814 r50228 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 */ 44 44 45 static intusbProxyVrdpOpen(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend)45 static DECLCALLBACK(int) usbProxyVrdpOpen(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend) 46 46 { 47 47 LogFlow(("usbProxyVrdpOpen: pProxyDev=%p pszAddress=%s, pvBackend=%p\n", pProxyDev, pszAddress, pvBackend)); 48 48 49 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 49 50 int rc = VINF_SUCCESS; 50 51 … … 58 59 if (RT_SUCCESS (rc)) 59 60 { 60 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)RTMemAlloc (sizeof(*pDevVrdp)); 61 if (pDevVrdp) 62 { 63 pDevVrdp->pCallback = pCallback; 64 pDevVrdp->pDevice = pDevice; 65 pProxyDev->Backend.pv = pDevVrdp; 66 pProxyDev->iActiveCfg = 1; /** @todo that may not be always true. */ 67 pProxyDev->cIgnoreSetConfigs = 1; 68 return VINF_SUCCESS; 69 } 70 71 pCallback->pfnClose (pDevice); 72 rc = VERR_NO_MEMORY; 61 pDevVrdp->pCallback = pCallback; 62 pDevVrdp->pDevice = pDevice; 63 pProxyDev->iActiveCfg = 1; /** @todo that may not be always true. */ 64 pProxyDev->cIgnoreSetConfigs = 1; 65 return VINF_SUCCESS; 73 66 } 74 67 } … … 82 75 } 83 76 84 static voidusbProxyVrdpClose(PUSBPROXYDEV pProxyDev)77 static DECLCALLBACK(void) usbProxyVrdpClose(PUSBPROXYDEV pProxyDev) 85 78 { 86 79 LogFlow(("usbProxyVrdpClose: pProxyDev = %p\n", pProxyDev)); 87 80 88 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;81 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 89 82 90 83 pDevVrdp->pCallback->pfnClose (pDevVrdp->pDevice); 91 84 } 92 85 93 static intusbProxyVrdpReset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux)86 static DECLCALLBACK(int) usbProxyVrdpReset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux) 94 87 { 95 88 LogFlow(("usbProxyVrdpReset: pProxyDev = %p\n", pProxyDev)); 96 89 97 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;90 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 98 91 99 92 int rc = pDevVrdp->pCallback->pfnReset (pDevVrdp->pDevice); … … 111 104 } 112 105 113 static intusbProxyVrdpSetConfig(PUSBPROXYDEV pProxyDev, int cfg)106 static DECLCALLBACK(int) usbProxyVrdpSetConfig(PUSBPROXYDEV pProxyDev, int cfg) 114 107 { 115 108 LogFlow(("usbProxyVrdpSetConfig: pProxyDev=%s cfg=%#x\n", pProxyDev->pUsbIns->pszName, cfg)); 116 109 117 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;110 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 118 111 119 112 int rc = pDevVrdp->pCallback->pfnSetConfig (pDevVrdp->pDevice, (uint8_t)cfg); … … 128 121 } 129 122 130 static intusbProxyVrdpClaimInterface(PUSBPROXYDEV pProxyDev, int ifnum)123 static DECLCALLBACK(int) usbProxyVrdpClaimInterface(PUSBPROXYDEV pProxyDev, int ifnum) 131 124 { 132 125 LogFlow(("usbProxyVrdpClaimInterface: pProxyDev=%s ifnum=%#x\n", pProxyDev->pUsbIns->pszName, ifnum)); 133 126 134 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;127 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 135 128 136 129 int rc = pDevVrdp->pCallback->pfnClaimInterface (pDevVrdp->pDevice, (uint8_t)ifnum); … … 145 138 } 146 139 147 static intusbProxyVrdpReleaseInterface(PUSBPROXYDEV pProxyDev, int ifnum)140 static DECLCALLBACK(int) usbProxyVrdpReleaseInterface(PUSBPROXYDEV pProxyDev, int ifnum) 148 141 { 149 142 LogFlow(("usbProxyVrdpReleaseInterface: pProxyDev=%s ifnum=%#x\n", pProxyDev->pUsbIns->pszName, ifnum)); 150 143 151 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;144 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 152 145 153 146 int rc = pDevVrdp->pCallback->pfnReleaseInterface (pDevVrdp->pDevice, (uint8_t)ifnum); … … 162 155 } 163 156 164 static intusbProxyVrdpSetInterface(PUSBPROXYDEV pProxyDev, int ifnum, int setting)157 static DECLCALLBACK(int) usbProxyVrdpSetInterface(PUSBPROXYDEV pProxyDev, int ifnum, int setting) 165 158 { 166 159 LogFlow(("usbProxyVrdpSetInterface: pProxyDev=%p ifnum=%#x setting=%#x\n", pProxyDev, ifnum, setting)); 167 160 168 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;161 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 169 162 170 163 int rc = pDevVrdp->pCallback->pfnInterfaceSetting (pDevVrdp->pDevice, (uint8_t)ifnum, (uint8_t)setting); … … 179 172 } 180 173 181 static boolusbProxyVrdpClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int ep)174 static DECLCALLBACK(bool) usbProxyVrdpClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int ep) 182 175 { 183 176 LogFlow(("usbProxyVrdpClearHaltedEp: pProxyDev=%s ep=%u\n", pProxyDev->pUsbIns->pszName, ep)); 184 177 185 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;178 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 186 179 187 180 int rc = pDevVrdp->pCallback->pfnClearHaltedEP (pDevVrdp->pDevice, (uint8_t)ep); … … 196 189 } 197 190 198 static intusbProxyVrdpUrbQueue(PVUSBURB pUrb)191 static DECLCALLBACK(int) usbProxyVrdpUrbQueue(PVUSBURB pUrb) 199 192 { 200 193 LogFlow(("usbProxyVrdpUrbQueue: pUrb=%p\n", pUrb)); … … 208 201 209 202 PUSBPROXYDEV pProxyDev = PDMINS_2_DATA(pUrb->pUsbIns, PUSBPROXYDEV); 210 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;203 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 211 204 212 205 int rc = pDevVrdp->pCallback->pfnQueueURB (pDevVrdp->pDevice, pUrb->enmType, pUrb->EndPt, pUrb->enmDir, pUrb->cbData, … … 222 215 } 223 216 224 static PVUSBURBusbProxyVrdpUrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies)217 static DECLCALLBACK(PVUSBURB) usbProxyVrdpUrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies) 225 218 { 226 219 LogFlow(("usbProxyVrdpUrbReap: pProxyDev=%s\n", pProxyDev->pUsbIns->pszName)); 227 220 228 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;221 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 229 222 230 223 PVUSBURB pUrb = NULL; … … 252 245 } 253 246 254 static voidusbProxyVrdpUrbCancel(PVUSBURB pUrb)247 static DECLCALLBACK(void) usbProxyVrdpUrbCancel(PVUSBURB pUrb) 255 248 { 256 249 LogFlow(("usbProxyVrdpUrbCancel: pUrb=%p\n", pUrb)); 257 250 258 251 PUSBPROXYDEV pProxyDev = PDMINS_2_DATA(pUrb->pUsbIns, PUSBPROXYDEV); 259 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;252 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 260 253 261 254 pDevVrdp->pCallback->pfnCancelURB (pDevVrdp->pDevice, (PREMOTEUSBQURB)pUrb->Dev.pvPrivate); 262 255 } 263 256 264 static intusbProxyVrdpWakeup(PUSBPROXYDEV pProxyDev)257 static DECLCALLBACK(int) usbProxyVrdpWakeup(PUSBPROXYDEV pProxyDev) 265 258 { 266 259 LogFlow(("usbProxyVrdpWakeup: pProxyDev=%s\n", pProxyDev->pUsbIns->pszName)); 267 260 268 PUSBPROXYDEVVRDP pDevVrdp = (PUSBPROXYDEVVRDP)pProxyDev->Backend.pv;261 PUSBPROXYDEVVRDP pDevVrdp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVVRDP); 269 262 270 263 return pDevVrdp->pCallback->pfnWakeup (pDevVrdp->pDevice); … … 276 269 extern const USBPROXYBACK g_USBProxyDeviceVRDP = 277 270 { 271 /* pszName */ 278 272 "vrdp", 273 /* cbBackend */ 274 sizeof(USBPROXYDEVVRDP), 279 275 usbProxyVrdpOpen, 280 276 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.