Controlling the USB port on the mini dock using PHP?
-
I have an Omega2+ that's attached to a Mini dock .. which means that I only have access to is a single USB port (I don't have access to any of the I/O pins).
Is there any way that I can turn the USB port on or off using PHP? If so, how?
I ask because I was thinking of trying something like .. say .. hooking up a USB powered lamp / light bulb .. and I thought it might be fun to experiment with turning it on and off remotely. Is this possible at all? If so, please advise.
Thanks,
- Yvan
-
No. Not the right way.
Please understand how USB works (the power distribution feature, client mode, and server mode) first.
-
Ok .. then is there at least some kind of lamp-like device that I could purchase and connect to the USB port and remote control somehow -- not by turning the port on or off -- but by instead sending some kind of "ON" or "OFF" command to the device over USB? I understand that the Expansion dock would be more suitable for achieving something like this .. but I'm just trying to leverage whatever's possible using the mini dock.
- Yvan
-
If the device is really, really simple it won't event connect the D+ and D- (data) signals to anything locally, i.e., it will just draw power from the USB bus over V_BUS (5V) and GND. Without the data lines connected to anything it won't even show up as USB device on your linux system. For that case, you may be able to implement a USB intercepter however.. You just need a second Male-to-Female USB port plug with MOSFETs as switches in between to cut off power. Then you could control it over GPIO pins (and thus also over PHP using the filesystem).
For the other case, have you had a look at https://stackoverflow.com/a/12675749/5296568 and https://askubuntu.com/questions/342061/power-on-off-usb-ports ?
-
@Yvan-Gagnon I've mentioned this a couple times in response to other posts and do not remember if one of those posts was yours, if so, I apologize for bringing it up again, but, it is possible to gain access to all the pins by using a female header with long pins. just insert the female header into each header of the mini dock and then insert [carefully] the omega2+ into the long pin female headers. this will leave all pins exposed that you can then use various methods to attach wires from your project to the appropriate pins. granted it is a "garage style" method and care must be taken to not damage the long pin headers, however it worked for any project i saw hooked up this way at a local hackerspace.