Q: Enable/disable usb device
I would like to enable and disable connected USB devices. I found that "system_profiler SPUSBDataType" shows details nicely while "ioreg -p IOUSB" shows in a tree like:
+-o Root <class IORegistryEntry, id 0x100000100, retain 14>
+-o Root Hub Simulation Simulation@14000000 <class AppleUSBRootHubDevice, id 0x1000002f0, registered, matched, active, busy 0 (0 ms), retain 12>
+-o Keyboard Hub@14100000 <class AppleUSBDevice, id 0x1000002f1, registered, matched, active, busy 0 (0 ms), retain 12>
| +-o Apple Keyboard@14120000 <class AppleUSBDevice, id 0x100000329, registered, matched, active, busy 0 (4 ms), retain 13>
+-o IR Receiver@14400000 <class AppleUSBDevice, id 0x100000311, registered, matched, active, busy 0 (13 ms), retain 14>
+-o USB Optical Mouse@14200000 <class AppleUSBDevice, id 0x10000031f, registered, matched, active, busy 0 (15 ms), retain 11>
+-o BRCM20702 Hub@14300000 <class AppleUSBDevice, id 0x100000469, registered, matched, active, busy 0 (1 ms), retain 12>
| +-o Bluetooth USB Host Controller@14330000 <class AppleUSBDevice, id 0x1000004a6, registered, matched, active, busy 0 (1 ms), retain 17>
+-o iPad@14200000 <class IOUSBDevice, id 0x1000009bd, registered, matched, active, busy 0 (131 ms), retain 12>
+-o SAMSUNG_Android@14600000 <class AppleUSBDevice, id 0x100004e8c, registered, matched, active, busy 0 (8 ms), retain 15>
I specifically would like to enable and disable the mobile devices from the command line terminal (which I can do in linux using udev).
What are the appropriate commands to do that in the OS X terminal? I found that it is possible to remove all USB devices and hubs by changing the respective kext but that is not I am after. I need to be able to disable just one mobile device for a time (while a program runs, so time is not known when disabling) and enable afterwards.
Mac mini, OS X El Capitan (10.11.6)
Posted on Sep 1, 2016 7:43 AM