2

Is there any way that I could use what I'll call PC-A to act like a USB device to a second PC, PC-B?

i.e.

PC-A <<-- Double male USB cable --> PC-B

The result I'm looking to achieve is have various directories or images on PC-A appear as a USB drive to PC-B when connected and be able to change directories when needed and appear to PC-B like a different USB drive has been inserted. Also as an extension of my question could I achieve a similar result but emulate a USB mouse or keyboard, or forward the mouse and keyboard from PC-A to PC-B through said interface?

PC-B would be one of any number of old PCs I am testing. PC-A would ideally be a means of simplifying or somewhat automating the process.

I'm also simply curious if it can be done just because I like to try out of the box stuff anyways even if the end result isn't practical for my use-case. :P

  • 2
    Do you just want to share the files from a mounted USB on PC-A to PC-B? If so you don't need to contemplate what you're asking. To my knowledge you cannot share USB ports from one PC to another. – slm Apr 28 '14 at 3:55
  • @slm's right - not normal ones anyway. You'd have to mod the cable to ensure both computers arent pushing 5V at each other. After that, sure. – mikeserv Apr 28 '14 at 4:03
  • 1
    Thanks for asking this question. Saved me some trouble writing it and the answer is pretty clear. – Depado Dec 28 '14 at 19:29
3

As @slm already indicated you cannot normally do so. USB ports on PCs are not 'simple' serial ports. To support the higher speeds the ICs handling the USB port traffic contain logic that—for normal PCs—restrict the device to be a "master" or a "slave" in the communication.

Your PCs will be having "master logic" and they cannot talk to each other.

There are ICs for USB that can be programmed to be either "master" or "slave" (I have one on one of my Arduino devices, but those chips are more expensive and you don't find them on a normal PC.

This "master"/"slave" distinction is also the reason why e.g. my cars navigation device, that has a USB connection and runs Linux, cannot do anything with the the (slave) USB port but go into passive mode, to receive updates from my PC. It cannot control an external harddrive or anything.

I think, but I don't have references for that, that this distinction is one of the reasons for having different connectors on the USB cable (apart from wanting a smaller connector on your phone/Bluetooth headset than on your PC).

  • You can change master/slave relationships on your computer via comm i/o in software. But you do have to deal with the voltage issue. linux-usb.org/gadget – mikeserv Apr 28 '14 at 4:16
  • 1
    @mikeserv you need special USB chip devices for that, the list of some of that is provided on that page. As I indicated the price difference with "normal" USB chips precluded them from being used in run-of-the-mill motherboards. – Anthon Apr 28 '14 at 4:19
  • You really don't if you use the Ethernet over USB protocol for a local network. You could then take it one step deeper and use USBIP. Both are implemented in-kernel. What you need is a modified cable. – mikeserv Apr 28 '14 at 4:31
1

If the underlying problem is to share files between two PCs, you should seriously consider networking the two computer together (quite easy really), and then use NFS to share filesystems between the two systems.

Logging to either system would be possible as well.

You could do such things as running X windowing system and maybe VNC depending on how you would want to share the systems.

I would be concerned about using USB devices as I have had some significant problems with some of the subtility of how either the devices and/or drivers cause problematic and sometimes frustrating issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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