I am trying to get information on how to reset the USB port on a MacBook Pro using terminal's command line. I use the USB port to access a network device via a serial port with an ioread GUC232A to conduct automation. When the script is done, I have to physically disconnect and re-connect the USB<->Serial adapter in order to free the MacBook USB port for a subsequent automation run. As you can see, this is not workable.

I've looked at the following solution but it does not work very reliably and frankly, I'm not too keen on unloading and reloading drivers.

sudo kextunload IOUSBMassStorageClass.kext
sudo kextload /System/Library/Extensions/IOUSBMassStorageClass.kext

I could use a single port terminal server from Lantronix to access the terminal server via SSH, which is in turn connected via RS232 - But this solution is not on the table at this point.

Any suggestions on a USB to Ethernet Terminal server, where the USB port will act as a console to access the networking device would be appreciated.



There are two ways to reset a USB:

  • Hardware (see below). This acts like plugging and unplugging a device. Great for when testing a single device that needs to be reset.
  • Software (How to restart USB subsystem?). This will completely reset the USB bus. Great for when the USB subsystem is hung up.

I saw a similar scenario solved by putting a momentary switch in-line with the USB +5V line on the USB cable (usually the red connector). When the engineer wanted to reset the device (simulate removing then reinserting the device), he would depress (held it for a second or two) the switch cutting power to the USB device. When the released it, power would be restored re-powering the device and the computer would reload it.

enter image description here

The advantage this had over doing something on Terminal was that it affected only the device in question and not all devices on the entire USB bus.

Doing a quick search, I was able to find pre-made switches that accomplish this for less than $10 USD

enter image description here

For a less "cludgy" solution, you could get a USB hub with individual power switches like the Sabrent 4 Port.

  • Thank you for the great explanation and the links. As mentioned in the original post, I am looking for a solution that can be automated. Any suggestions on a USB to Ethernet Terminal server, where the USB port will act as a console to access the networking device would be appreciated. – pythonian Aug 14 '17 at 17:29
  • 1
    I saw this product from Digi that's USB over IP just recently, but if you need to reset the port automatically, what about Arduino or Rasp. Pi? You could make the switch I described with a interface that can be controlled via ssh command. Just a thought. – Allan Aug 14 '17 at 17:35
  • That sounds very interesting. I thought about doing a rasp. Pi solution, but I just wanted to see if anyone knew of a solution that was already developed and could be a "plug-n-play" solution. – pythonian Aug 14 '17 at 18:13
  • Your Digi link looks like it's jackpot! I'll try that... Thank you very much @Allan – pythonian Aug 14 '17 at 18:22
  • 1
    @pythonian - After some research for another similar question, I have found a way to reset the USB via command line. See this question/answer – Allan Aug 28 '17 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .