Friday, November 9, 2012

Ejecting invisible usb devices on Mac

I needed to program a DM3601 Motorola radio the other day on my mac. I use virtualbox to run a windows XP session with a copy of CPS to configure the radio via usb cable. Normally usb devices need removing or ejecting from the host machine before the virtualbox has access to the hardware, but in this case it wasnt so easy....

Not knowing what to expect I attached a usb cable to the radio and plugged it to the usb slot on the mac. 

After plugging it in there was no usb device to be found, so I looked in the system information (applications->utilities) and thus knew the kernel has loaded something, but there was nothing to eject it as there were no icons anywhere. The solution was to unload the kernel module resonsible for holding the hardware via a terminal session.

I did the following:

Pop up a terminal and run:


# kextstat

   :
   :
  130    0 0xffffff7f81d01000 0x5000     0x5000     com.apple.driver.AppleHWSensor (1.9.5d0) <5 4 3>  131    3 0xffffff7f80a3a000 0x42000    0x42000    org.virtualbox.kext.VBoxDrv (4.2.4) <7 5 4 3 1>  132    0 0xffffff7f80795000 0x8000     0x8000     org.virtualbox.kext.VBoxUSB (4.2.4) <131 43 30 7 5 4 3 1>  133    0 0xffffff7f8079d000 0x5000     0x5000     org.virtualbox.kext.VBoxNetFlt (4.2.4) <131 7 5 4 3 1>  134    0 0xffffff7f807a2000 0x6000     0x6000     org.virtualbox.kext.VBoxNetAdp (4.2.4) <131 5 4 1>  143    0 0xffffff7f807ab000 0xd000     0xd000     com.apple.nke.asp_tcp (6.0.1) <7 6 5 4 3 1>  144    1 0xffffff7f807b8000 0x12000    0x12000    com.apple.security.SecureRemotePassword (1.0) <4 1>  145    0 0xffffff7f81001000 0x51000    0x51000    com.apple.filesystems.afpfs (9.8.1) <144 7 6 5 4 3 1>  152    0 0xffffff7f807ca000 0x3000     0x3000     com.apple.driver.AppleUSBCDC (4.1.22) <30 4 3>


...which lists the kernel extensions that have loaded and viola at the bottom of the list is the USB module responsible for the device I just connected.

unload it with this:


# kextunload -b com.apple.driver.AppleUSBCDC




Now I could connect the virtualbox to the usb without a glitch.



No comments:

Post a Comment