![]() ![]() My first example of this is that all Apple Mac computers with a USB-C port have the capability of going into a USB-C slave mode. I do wish people would stop repeating the erroneous claim that all personal computers lack the hardware to act as a USB device/slave/gadget/whatever. Unfortunately, it's not as simple as just plugging in the cable and getting a point-to-point network connection. USB-C (the new style with symmetric plugs, the same on both ends) does allow plugging one computer into another. If you want to use a computer as a USB storage device, you can use a mobile phone or tablet with a USB connection instead of using a PC. So no, you won't be able to make a PC into a USB device. This requires electronics on the controller, it isn't enough to make a cable that fits on both ends. The ports are physically device-type ports, not host-type ports. It is possible for a USB port to be able to act as either side this is called USB on-the-go and is present on some mobile phones and tablets. You can't make a peripheral device act as a host or vice versa. USB A/B (the old style with different plug shapes on each end, and where each end can only plugged in one way) is dissymmetric: one side is a host, the other side is a peripheral device. At least, not until someone comes out with that elusive adapter with a device or OTG port on it that plugs into a USB port (theoretically, that could be done with a microcontroller such an Arduino wired to a pair of USB device controller ICs), and writes the drivers to run it. Practically, unless you're a top-notch electronics engineer, you're not going to be able to do it. ![]() Then you can install Linux and use a gadget driver, or write your own for another OS. You can tear down your desktop PC, try and find an unused compatible bus on the motherboard somewhere (most likely some unused pins on a controller IC), or a way to extend an internal I2C or SPI bus, or something you can tear out and replace, and solder a USB OTG or device controller chip onto it. For Windows or other OSes, you'd probably have to write that device driver yourself. The BeagleBone Black tends to come with this enabled by default, so you can simply plug it into your PC over USB and see it as a networked device - and I believe it also appears as a mass storage device by using a composite driver (which allows it to appear as multiple USB device types over a single connection.) The Pi Zero can use these, but does not by default. Linux has some useful kernel USB Gadget drivers ("USB gadget" is another term for USB peripheral/device) such as g_serial and g_ethernet that allow you to plug your device into another computer and be visible as a serial or ethernet-over-USB device (there are others for exposing a device as mass storage, which allow you to use a file as a block device and expose the computer as a mass storage gadget). That's not all though - once you've got the hardware, you'd also need the software. For example, the aforementioned Raspberry Pi has an On-the-Go Controller, but on all models except the Pi Zero that gets rewired to a host port or an onboard USB hub denying the use of USB device functionality. Motherboards designed for embedded and portable devices tend to have a USB OTG (On-the-go) contoller, which can function as either a Host or Device controller. The other option would be a USB On-the-Go Controller. You might be lucky enough to find an SPI or I2C bus exposed somewhere on your motherboard to allow you to add it, but they're usually wired directly into whatever they're being used for unless you're using a dev board or single-board computer with exposed GPIO and other ports such as a Raspberry Pi. Practically, you'd have to redesign the motherboard to include it. Unfortunately, you'd have to find a way to wire it onto your motherboard. You would need to add a USB Device/Peripheral controller to the computer, as opposed to the USB Host Controller they tend to come with. Linux, however, does include USB-C device mode drivers (aka "USB Gadget" drivers - although you may need to compile a custom kernel if they haven't been included in your distribution.) The main problem is still mostly on the Windows PC side, where there's a lack of any USB-C device mode drivers with the OS. Many devices - especially SBCs - come with USB-C and a controller which can run in both modes. We now have USB-C, for example, which supports both device and host modes. Edit: While this answer was correct at the time (with a few rare exceptions), since then there's been more developments. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |