Index: /trunk/src/VBox/Main/src-server/darwin/iokit.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/darwin/iokit.cpp	(revision 59329)
+++ /trunk/src/VBox/Main/src-server/darwin/iokit.cpp	(revision 59330)
@@ -50,4 +50,5 @@
 #include <iprt/thread.h>
 #include <iprt/uuid.h>
+#include <iprt/system.h>
 #ifdef STANDALONE_TESTCASE
 # include <iprt/initterm.h>
@@ -76,4 +77,11 @@
 #define VBOXUSBDEVICE_CLASS_NAME "org_virtualbox_VBoxUSBDevice"
 
+/** Define the constant for the IOUSBHostDevice class name added in El Capitan. */
+#ifndef kIOUSBHostDeviceClassName
+# define kIOUSBHostDeviceClassName "IOUSBHostDevice"
+#endif
+
+/** The major darwin version indicating OS X El Captian, used to take care of the USB changes. */
+#define VBOX_OSX_EL_CAPTIAN_VER 15
 
 /*********************************************************************************************************************************
@@ -82,4 +90,7 @@
 /** The IO Master Port. */
 static mach_port_t g_MasterPort = NULL;
+/** Major darwin version as returned by uname -r. 
+ * Used to  changes to */
+uint32_t g_uMajorDarwin = 0;
 
 
@@ -95,4 +106,19 @@
         kern_return_t krc = IOMasterPort(MACH_PORT_NULL, &g_MasterPort);
         AssertReturn(krc == KERN_SUCCESS, false);
+
+        /* Get the darwin version we are running on. */
+        char aszVersion[16] = { 0 };
+        int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, &aszVersion[0], sizeof(aszVersion));
+        if (RT_SUCCESS(rc))
+        {
+            /* Make sure it is zero terminated (paranoia). */
+            aszVersion[15] = '\0';
+            rc = RTStrToUInt32Ex(&aszVersion[0], NULL, 10, &g_uMajorDarwin);
+            if (   rc != VINF_SUCCESS
+                && rc != VWRN_TRAILING_CHARS)
+                LogRel(("IOKit: Failed to convert the major part of the version string \"%s\" into an integer\n", &aszVersion[0]));
+        }
+        else
+            LogRel(("IOKit: Failed to query the OS release version with %Rrc\n", rc));
     }
     return true;
@@ -517,4 +543,16 @@
 } DARWINUSBNOTIFY, *PDARWINUSBNOTIFY;
 
+/**
+ * Returns the correct class name to identify USB devices. El Capitan
+ * introduced a reworked USb stack with changed names.
+ * The old names are still available but the objects don't reveal all the
+ * information required.
+ */
+DECLINLINE(const char *)darwinGetUsbDeviceClassName(void)
+{
+    return   g_uMajorDarwin >= VBOX_OSX_EL_CAPTIAN_VER
+           ? kIOUSBHostDeviceClassName
+           : kIOUSBDeviceClassName;
+}
 
 /**
@@ -619,5 +657,5 @@
             kern_return_t rc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
                                                                 kIOPublishNotification,
-                                                                IOServiceMatching(kIOUSBDeviceClassName),
+                                                                IOServiceMatching(darwinGetUsbDeviceClassName()),
                                                                 darwinUSBAttachNotification1,
                                                                 pNotify,
@@ -628,5 +666,5 @@
                 rc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
                                                       kIOMatchedNotification,
-                                                      IOServiceMatching(kIOUSBDeviceClassName),
+                                                      IOServiceMatching(darwinGetUsbDeviceClassName()),
                                                       darwinUSBAttachNotification2,
                                                       pNotify,
@@ -637,5 +675,5 @@
                     rc = IOServiceAddMatchingNotification(pNotify->NotifyPort,
                                                           kIOTerminatedNotification,
-                                                          IOServiceMatching(kIOUSBDeviceClassName),
+                                                          IOServiceMatching(darwinGetUsbDeviceClassName()),
                                                           darwinUSBDetachNotification,
                                                           pNotify,
@@ -820,5 +858,6 @@
                         fUserClientOnly = false;
 
-                        if (!strcmp(szName, "IOUSBMassStorageClass"))
+                        if (   !strcmp(szName, "IOUSBMassStorageClass")
+                            || !strcmp(szName, "IOUSBMassStorageInterfaceNub"))
                         {
                             /* Only permit capturing MSDs that aren't mounted, at least
@@ -906,5 +945,5 @@
      * Create a matching dictionary for searching for USB Devices in the IOKit.
      */
-    CFMutableDictionaryRef RefMatchingDict = IOServiceMatching(kIOUSBDeviceClassName);
+    CFMutableDictionaryRef RefMatchingDict = IOServiceMatching(darwinGetUsbDeviceClassName());
     AssertReturn(RefMatchingDict, NULL);
 
@@ -981,7 +1020,11 @@
                 darwinDictGetU8(PropsRef, CFSTR("PortNum"), &pCur->bPort); /* Not present in 10.11 beta 3, so ignore failure. (Is set to zero.) */
                 uint8_t bSpeed;
-                AssertBreak(darwinDictGetU8(PropsRef,  CFSTR(kUSBDevicePropertySpeed),  &bSpeed));
-                Assert(bSpeed <= 3);
-                pCur->enmSpeed = bSpeed == 3 ? USBDEVICESPEED_SUPER
+                AssertBreak(darwinDictGetU8(PropsRef,
+                                              g_uMajorDarwin >= VBOX_OSX_EL_CAPTIAN_VER
+                                            ? CFSTR("USBSpeed")
+                                            : CFSTR(kUSBDevicePropertySpeed),
+                                            &bSpeed));
+                Assert(bSpeed <= 4);
+                pCur->enmSpeed = bSpeed == 3 || bSpeed == 4 ? USBDEVICESPEED_SUPER
                                : bSpeed == 2 ? USBDEVICESPEED_HIGH
                                : bSpeed == 1 ? USBDEVICESPEED_FULL
@@ -1134,5 +1177,5 @@
      */
 
-    CFMutableDictionaryRef RefMatchingDict = IOServiceMatching(kIOUSBDeviceClassName);
+    CFMutableDictionaryRef RefMatchingDict = IOServiceMatching(darwinGetUsbDeviceClassName());
     AssertReturn(RefMatchingDict, NULL);
 
