Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am looking for a script which will allow me to disable one specific USB port on my Mac mini. It would only serve a purpose if it works in real-time and didn't require a reboot. I've found scripts for various Linux distros that seemed to do something similar - however most required a reboot.

I've got ambient lighting behind my monitor which is powered by USB and it doesn't turn off when the system sleeps. So my office is constantly lit up, it would be nice if I could write a script that would disable that specific USB port.

How to disable individual USB ports by script?

share|improve this question
add comment

2 Answers

Have you seen this thread and the code here? Maybe shell could be used to "manually" rename the device ID or port to something odd that won't work, upon a specified event, then renames it to what it's supposed to be later.

share|improve this answer
1  
Hey I have looked at the recommended thread but the code specified is no longer available on the apple site. Could you please paste it, into your answer if you still have a copy? –  Deesbek Oct 15 '13 at 0:22
    
I found the Google cache of the code and edited my comment above. I hope it helps— I don't know if this works or not, it was only an idea. –  Elliott Oct 15 '13 at 3:51
    
Thanks, I am just interested as I am trawling through random questions and after reading the answer below was keen to try your solution myself. –  Deesbek Oct 15 '13 at 4:10
add comment

Unfortunately, what you are asking is not possible with any OS X API or AppleScript hook. This is something controlled by the hardware layer of the OS and involves far more work than it's worth. While similar scripts exist for Linux, you must keep in mind that even though OS X and Linux are distant cousins, OS X wasn't built for such fine-grained control over its components like Linux was. Sadly, the only options you have in this case is to unplug the device or completely disable the USB interface. That last one, of course, isn't feasible for you, so unfortunately, there's no solution to this problem. Sorry. :(

Good luck and happy sleeping!

share|improve this answer
    
Can you cite a reason or documentation for "OS X wasn't built for such fine-grained control over its components like Linux was" Surely both Linux and OSX are Unix like OSs and have equal control over interfaces –  Mark Nov 16 '12 at 18:28
    
I think the USB power is controlled separately from the software. I temporarily removed all the IOUSB*.kext, and while the built-in trackpad and keyboard were dead, my kindle would still charge. (The iPhone wouldn't; but, that may be some Apple voodoo). By the way, don't remove all the IOUSB*.kext files unless you have a good recovery strategy (this particular macbook has multiple boot partitions, so, it will be easy to fix). –  Kent Oct 15 '13 at 7:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.