So i tried to connect steamdeck to pc using usb and i read its immpossible because steamdeck is a computer and some explanation on quora about strong master slave relationship. But then why is it possible for android phones to connect to pc whilist also having the ability to use USB and other usb c accesories. Also why cant it be a toggle? So that you can change whetewer this usb( or device ) is reciving data ot sending data .

  • edinbruh@feddit.it
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    5 months ago

    The USB protocol was simple by design, so it could be implemented in small dumb devices like pen drives. More specifically, it used two couples of cables, one couple was for power and the other for data (four wires in total). Having a single half-duplex data line means you need some way of arbitrating who can send data at any time. The easiest way to do it is having a single machine that decides who gets to send data (master), and the easiest way to decide the master is to not do it and have the computer always do the master. This means you couldn’t connect two computers together because they would both try to be the master.

    I used the past tense because you may have noticed that micro USB have 5 pins and not 4, that’s because phones are computers and they use the 5th pin to decide how to behave. If it’s grounded they act as a slave (the male micro to male A cable grounds it). If it has a resistor (the otg cable has it) it act as master. And if the devices are connected with a wire on that pin (on some special micro to micro) they negotiate the connection.

    When they made usb 3.0 and they realized that not having the 5th wire on the usb-A was stupid, so they put it (along side some extra data lines) that’s why they have an odd number of wires. So with usb 3 you can connect computers together, but you need a special cable that uses the negotiation wire. Also I don’t know what software you need for it to work.

    Usb-c is basically two USB 3.0 in the same cable, so you can probably connect computers with that. But often the port on the devices only uses one, so it might not be faster. Originally they put the pins for two connections so you could flip the connector, but later they realized they could use them to get double speed.

    • digdilem@lemmy.ml
      link
      fedilink
      arrow-up
      5
      ·
      5 months ago

      And it was a good design - it’s universal (aha) adoption proves that.

      Those of us old enough to remember the pain of using 9 and 25 pin serial leads and having to manually set baud rate and protocols, along with LPT and external SCSI and manufacturer specific sockets probably agree this was a problem that needed solving, and USB did do that.

  • Avid Amoeba@lemmy.ca
    link
    fedilink
    arrow-up
    4
    ·
    5 months ago

    We can connect two computers over USB and we do it all the time. E.g. your phone and your PC. One or both of the computers needs to be able to act as a device. Most Android computers can switch between host and device depending on what’s plugged in. It all comes down to implementation.

  • Björn Tantau@swg-empire.de
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    You actually can connect a Steam Deck to another PC. Look for the DeckMTP plugin on Decky Loader.

    MTP is the thing Android uses when you connect your phone to a PC. It should be possible to install on any PC. Don’t know about Windows but there’s probably a solution for that as well.

    Don’t know what happens when both devices have it. I’d suspect that they would both be able to access each other’s drive.

  • rotopenguin@infosec.pub
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    5 months ago

    The reason you can’t is “because Intel deliberately designed it that way”. Back when USB was just a notion, PDAs were a really cool thing. There was apparently concern at Intel that someday these little things might be all that someone might own. You might connect your PDA directly to the printer, rather than syncing it to your Intel Desktop and printing from there. You might connect your PDA to the modem and collect electronic mailographs directly, instead of syncing with a PC. If you could do enough without the PC middleman, you might even skip on buying an Intel computer altogether.

    So, Intel baked into the protocol anything they could think of to make peer-to-peer communications impossible in USB, make life easy for the singular PC communications master, and put a timing onus on devices that forced them to be dumbed-down state machines instead of computers in their own right.

    • Scipitie@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      5 months ago

      Is there anything to support this? I couldn’t find anything that really has this intend documented and Intel weren’t the only on pushing for usb as the most simple protocol possible ( I recall a lot of excitement about the “u” part… How naive at least I was back then!).

      I’m not knowledgeable enough to really argue against it, looking simply from an Okham point of view as “they wanted everything to connect” - the printer in the same way as that PDA… Plus Intels de facto (IT) world domination at the time it just seems unlikely.

      Edit: some sentences didn’t make even less sense, fixed.

  • Rustmilian@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    5 months ago

    I found some directions that might help.

    Enabling USB-C OTG Device Mode :
    Ensure the Linux device has a USB-C port that supports OTG functionality.
    In the device tree, set the dr_mode property of the USB OTG controller to “peripheral” or “otg” to enable device mode.
    Configure the TUSB320 USB-C controller (or equivalent) to operate in UFP (Upstream Facing Port) mode, which allows the device to act as a USB peripheral.
    Configuring USB Gadget Drivers :
    Load the appropriate Linux USB gadget driver for the desired functionality, such as g_ether for Ethernet over USB, g_serial for a serial device, etc.
    Manually configure the USB network interface, such as assigning an IP address to usb0.
    Connecting to a Host :
    Use a USB-C to USB-C or USB-C to USB-A cable to connect the Linux device in OTG device mode to a host PC.
    The host PC should then detect the Linux device as a USB peripheral, allowing file transfer, network connectivity, or other functionality depending on the configured gadget driver.

    Gateworks.com Wiki Linux OTG
    Kernel.org Driver-API USB Gadget
    Collabora Blog Modern Linux USB Gadget integration with Systemd Part1

    A tool : gt
    Rust library : usb-gadget
    C Library : libusbgx

  • Buffalox@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    5 months ago

    Google “connecting 2 computers with USB”

    If you have two PCs with USB ports, you can connect them to one another using a special type of USB cable called a “bridging” cable. You can also technically connect two Macs via USB, but you’ll need to add a USB-to-Ethernet adapter and Ethernet cable to the mix.

    There are also articles about it:
    https://hardwaresecrets.com/connecting-two-pcs-using-a-usb-usb-cable/

    We do it routinely with our phones (some of us), I admit IDK why it can’t be just as easy between 2 computers?