USB Devices - One-Way Only?

Started by
4 comments, last by outRider 15 years, 5 months ago
Certain phones and game consoles can be plugged using (usually mini-USB) cables into USB ports on computers so that music or games or whatever can be loaded onto the phone/console. My question is - is this a one-way process? If the device in question was easily programmable, like a homebrew-capable PSP (only an example), could a device like a USB keyboard or mouse be plugged into the USB port (originally intended for recieving data from the computer) and (with the proper drivers of course) be used with the embedded device? Or, is it possible that these USB ports are input-only in some way (which doesn't make sense, because then the computer would have no way of knowing what files were on the device)? My hunch is that a USB port is a USB port, and if the ability to write drivers for one exists, it can be used with any USB device that a driver has been written for. Am I correct? Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~I program in C++, on MSVC++ '05 Express, and on Windows. Most of my programs are also for windows.
Advertisement
USB is not a symmetrical protocol. If you somehow managed to plug two USB keyboards into each other, besides not having anything to say to each other they would be unable to communicate on an electronic level. It's not a matter of input versus output; it's a matter of host versus device.

It would be possible to make a device capable of acting as a repeater host for two devices; devices already exist which serve the opposite role, allowing two computers to communicate over a USB link. However, I'm not aware of such a device being commercially available. As you said, it would require rather specialized drivers, both to communicate with the far-end device as well as to configure the repeater itself.
Look up the USB OTG (on-the-go) spec, it allows for devices to act as both host/master and device/slave. An OTG device will act as a slave when connected a PC, and as a master when connected to a keyboard or mouse. This is a hardware feature, meaning the device has to have an OTG controller to do this, so you can't make a device with a host controller act as a slave or vice versa.
Quote:Original post by EmrldDrgn
If the device in question was easily programmable, like a homebrew-capable PSP (only an example), could a device like a USB keyboard or mouse be plugged into the USB port (originally intended for recieving data from the computer) and (with the proper drivers of course) be used with the embedded device?

The PSP already does this - you can hook it up to a pc and have it act as a slave (and able to read/write from the memory stick), or if you plug in the PSP camera or GPS unit then the PSP acts as a master and receives the input from the other device.
Where does the master/slave determination lie? Is it a hardware thing - the USB port is physically a different configuration somehow, or a hardware chip is missing from the device? Or is it a software issue? It seems as though the host has a hardware controller which the device lacks, is that correct?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~I program in C++, on MSVC++ '05 Express, and on Windows. Most of my programs are also for windows.
There are host controllers, peripheral controllers, and OTG controllers. A device with a host controller can only be a master, a device with a peripheral controller can only be a slave, and a device with an OTG controller can be both. There can only be one master per bus.

If two OTG devices are connected they will negotiate who is the master and who is the slave; by default the way in which the cable between them is oriented determines the initial master and slave, though they can renegotiate at any time the relationship between them.

This topic is closed to new replies.

Advertisement