Changeset 31911 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Aug 24, 2010 11:56:45 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 65121
- Location:
- trunk/src/VBox/HostDrivers/VBoxUSB
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/Makefile.kmk
r31898 r31911 34 34 USBLib_SDKS.win = WINPSDK W2K3DDK 35 35 USBLib_DEFS = IN_USBLIB 36 USBLib_DEFS.solaris = $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS)37 36 USBLib_DEFS.os2 = STATIC_USBCALLS 38 37 USBLib_SOURCES = \ -
trunk/src/VBox/HostDrivers/VBoxUSB/solaris/Makefile.kmk
r31898 r31911 32 32 SYSMODS.solaris += vboxusbmon 33 33 vboxusbmon_TEMPLATE = VBOXR0DRV 34 vboxusbmon_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) \ 35 $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS,) 34 vboxusbmon_DEFS = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) 36 35 vboxusbmon_DEPS += $(VBOX_SVN_REV_KMK) 37 vboxusbmon_INCS := . .. \ 38 $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),include/,) 36 vboxusbmon_INCS := . .. include 39 37 vboxusbmon_LDFLAGS += -N drv/vboxdrv -N misc/usba 40 38 vboxusbmon_SOURCES = \ … … 43 41 ../VBoxUSBFilterMgr.cpp 44 42 45 ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS46 43 # 47 44 # vboxusb - The Solaris Generic USB Client Kernel module. … … 49 46 SYSMODS.solaris += vboxusb 50 47 vboxusb_TEMPLATE = VBOXR0DRV 51 vboxusb_DEFS = IN_RT_R0 IN_SUP_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) \ 52 $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS,) 48 vboxusb_DEFS = IN_RT_R0 IN_SUP_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) 53 49 vboxusb_DEPS += $(VBOX_SVN_REV_KMK) 54 50 vboxusb_INCS := . include/ … … 56 52 vboxusb_SOURCES = \ 57 53 VBoxUSB-solaris.c 58 endif59 54 60 55 include $(KBUILD_PATH)/subfooter.kmk -
trunk/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c
r31898 r31911 33 33 #include <iprt/mem.h> 34 34 #include <iprt/semaphore.h> 35 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS 36 # include <iprt/path.h> 37 #endif 35 #include <iprt/path.h> 38 36 39 37 #define USBDRV_MAJOR_VER 2 … … 144 142 }; 145 143 146 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS147 144 /** 148 145 * Client driver info. … … 154 151 struct vboxusbmon_client_t *pNext; /* Pointer to next client */ 155 152 } vboxusbmon_client_t; 156 #endif157 153 158 154 /** … … 172 168 /** Global Mutex. */ 173 169 static kmutex_t g_VBoxUSBMonSolarisMtx; 174 175 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS176 170 /** Number of userland clients that have kept us open. */ 177 171 static uint64_t g_cVBoxUSBMonSolarisClient = 0; 178 172 /** Global list of client drivers registered with us. */ 179 173 vboxusbmon_client_t *g_pVBoxUSBMonSolarisClients = 0; 180 #endif181 182 174 /** Opaque pointer to list of soft states. */ 183 175 static void *g_pVBoxUSBMonSolarisState; … … 188 180 static int vboxUSBMonSolarisProcessIOCtl(int iFunction, void *pvState, void *pvData, size_t cbData, size_t *pcbReturnedData); 189 181 static int vboxUSBMonSolarisResetDevice(char *pszDevicePath, bool fReattach); 190 #ifndef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS191 static int vboxUSBMonSolarisGetDeviceInstance(char *pszDevicePath, int32_t *pInstance);192 #endif193 182 194 183 … … 196 185 * Monitor Global Hooks * 197 186 *******************************************************************************/ 198 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS199 187 static int vboxUSBMonSolarisClientInfo(vboxusbmon_state_t *pState, PVBOXUSB_CLIENT_INFO pClientInfo); 200 188 int VBoxUSBMonSolarisRegisterClient(dev_info_t *pClientDip, PVBOXUSB_CLIENT_INFO pClientInfo); … … 202 190 int VBoxUSBMonSolarisElectDriver(usb_dev_descr_t *pDevDesc, usb_dev_str_t *pDevStrings, char *pszDevicePath, int Bus, int Port, 203 191 char **ppszDrv, void *pvReserved); 204 #endif205 192 206 193 … … 352 339 case DDI_DETACH: 353 340 { 354 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS355 341 /* 356 342 * Free all registered clients' info. … … 365 351 } 366 352 mutex_exit(&g_VBoxUSBMonSolarisMtx); 367 #endif368 353 369 354 vboxusbmon_state_t *pState = ddi_get_driver_private(g_pDip); … … 447 432 } 448 433 449 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS450 434 mutex_enter(&g_VBoxUSBMonSolarisMtx); 451 435 if (!g_cVBoxUSBMonSolarisClient) … … 463 447 g_cVBoxUSBMonSolarisClient++; 464 448 mutex_exit(&g_VBoxUSBMonSolarisMtx); 465 #endif466 449 467 450 for (iOpenInstance = 0; iOpenInstance < 4096; iOpenInstance++) … … 477 460 { 478 461 LogRel((DEVICE_NAME ":VBoxUSBMonSolarisOpen: too many open instances.")); 479 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS480 462 mutex_enter(&g_VBoxUSBMonSolarisMtx); 481 463 g_cVBoxUSBMonSolarisClient--; 482 464 mutex_exit(&g_VBoxUSBMonSolarisMtx); 483 #endif484 465 return ENXIO; 485 466 } … … 508 489 } 509 490 510 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS511 491 mutex_enter(&g_VBoxUSBMonSolarisMtx); 512 492 g_cVBoxUSBMonSolarisClient--; … … 527 507 else 528 508 mutex_exit(&g_VBoxUSBMonSolarisMtx); 529 #endif530 509 531 510 /* … … 771 750 } 772 751 773 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS774 752 case VBOXUSBMON_IOCTL_CLIENT_INFO: 775 753 { … … 782 760 break; 783 761 } 784 #else785 case VBOXUSBMON_IOCTL_DEVICE_INSTANCE:786 {787 CHECKRET_MIN_SIZE("DEVICE_INSTANCE", sizeof(VBOXUSBREQ_DEVICE_INSTANCE));788 789 VBOXUSBREQ_DEVICE_INSTANCE *pReq = (VBOXUSBREQ_DEVICE_INSTANCE *)pvData;790 rc = vboxUSBMonSolarisGetDeviceInstance(pReq->szDevicePath, (int32_t *)pReq->pInstance);791 *pcbReturnedData = cbData;792 LogFlow((DEVICE_NAME ":vboxUSBMonSolarisProcessIOCtl: DEVICE_INSTANCE returned %d\n", rc));793 break;794 }795 #endif796 762 797 763 case VBOXUSBMON_IOCTL_GET_VERSION: … … 825 791 LogFlowFunc((DEVICE_NAME ":vboxUSBMonSolarisResetDevice pszDevicePath=%s fReattach=%d\n", pszDevicePath, fReattach)); 826 792 827 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS828 793 /* 829 794 * Try grabbing the dev_info_t. … … 878 843 } 879 844 880 #else881 /*882 * Try grabbing the dev_info_t.883 */884 dev_info_t *pDeviceInfo = e_ddi_hold_devi_by_path(pszDevicePath, 0);885 if (pDeviceInfo)886 {887 /*888 * Try re-enumerating the device.889 */890 rc = usb_reset_device(pDeviceInfo, fReattach ? USB_RESET_LVL_REATTACH : USB_RESET_LVL_DEFAULT);891 LogFlow((DEVICE_NAME ":usb_reset_device for %s level=%s returned %d\n", pszDevicePath, fReattach ? "ReAttach" : "Default", rc));892 893 ddi_release_devi(pDeviceInfo);894 switch (rc)895 {896 case USB_SUCCESS: rc = VINF_SUCCESS; break;897 case USB_INVALID_PERM: rc = VERR_PERMISSION_DENIED; break;898 case USB_INVALID_ARGS: rc = VERR_INVALID_PARAMETER; break;899 900 /* @todo find better codes for these (especially USB_BUSY) */901 case USB_BUSY:902 case USB_INVALID_CONTEXT:903 case USB_FAILURE: rc = VERR_GENERAL_FAILURE; break;904 905 default: rc = VERR_UNRESOLVED_ERROR; break;906 }907 }908 else909 {910 rc = VERR_INVALID_HANDLE;911 LogRel(("vboxUSBMonSolarisResetDevice: Cannot obtain dev_info_t for Device %s\n", pszDevicePath));912 }913 #endif914 915 845 return rc; 916 846 } 917 918 #ifndef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS919 920 static int vboxUSBMonSolarisGetDeviceInstance(char *pszDevicePath, int32_t *pInstance)921 {922 LogFlowFunc((DEVICE_NAME ":vboxUSBMonSolarisGetDeviceInstance pszDevicePath=%s pInstance=%p\n", pszDevicePath, pInstance));923 924 AssertPtrReturn(pInstance, VERR_INVALID_POINTER);925 926 /*927 * Try grabbing the dev_info_t.928 */929 dev_info_t *pDeviceInfo = e_ddi_hold_devi_by_path(pszDevicePath, 0);930 if (pDeviceInfo)931 {932 /*933 * Get device instance.934 */935 *pInstance = ddi_get_instance(pDeviceInfo);936 ddi_release_devi(pDeviceInfo);937 LogFlow(("vboxUSBMonSolarisGetDeviceInstance: instance %d\n", *pInstance));938 return VINF_SUCCESS;939 }940 else941 LogRel(("vboxUSBMonSolarisGetDeviceInstance: Cannot obtain dev_info_t for Device %s\n", pszDevicePath));942 return VERR_INVALID_HANDLE;943 }944 945 #else /* VBOX_WITH_NEW_USB_CODE_ON_SOLARIS */946 847 947 848 static int vboxUSBMonSolarisClientInfo(vboxusbmon_state_t *pState, PVBOXUSB_CLIENT_INFO pClientInfo) … … 1150 1051 return USB_SUCCESS; 1151 1052 } 1152 1153 #endif1154
Note:
See TracChangeset
for help on using the changeset viewer.