1

I'm trying to send information via pyusb from host a to host b, the issue is that I can't get my USB crossover cable to show up on either end via lsusb, or even doubly connected to the same host. I don't know how to address/identify the port I've connected to to even send information over. I know its possible to do this, but not how to actually set it up. I would like to make one of the hosts a device, or a slave to the other, as if it was a real USB device, I only care about two way communication in so far as it is needed to set up the device -> host communication

I imagine I'm going to have to create my own device description, but that doesn't explain any part of the process to actually get a linux based system to identify it.

I guess what I'm looking for is a way to address the hosts on either end or the connection itself, something for me to identify and then use with pyusb so I can actually send information over, and then let me use one as an actual usb device.

EDIT: Looking around more it seems like I need to use g_serial some how on the host I intend to make act like a device. That should include the proper drivers and I should be able to hook up both sides that way, however this still seems to require a usb device port, and obviously I'm not using an embedded system on either end, so I don't have access to a device port or both.

I'm open for some sort of host hardware converter to device, but I need to make sure bandwidth is not sacrificed. Bandwidth is also the reason I'm not using Ethernet.

I'm willing to forgo all that though if I'm able to send information straight over the port some how. Clearly this is also possible because there exists special software with other cables that allow file transfer (and windows recognizes my cable when connected to linux). I need the ability to do this as well.

EDIT: dmesg output is too large, but here is something interesting:

usb usb4-port1: Cannot enable. Maybe the USB cable is bad? 

this gets displayed for thousands of lines.

also get this from windows side (not actually what I'm trying to do) enter image description here

Krupip
  • 131
  • 1
  • 8
  • Just because the spec says it's possible for USB 3.0 doesn't mean common PC USB 3.0 host adapters actually implement this part of the spec. And then the host adapter kernel driver will also have to support it (and I don't know of any Linux driver that does that). So chances that it will actually work on your hardware are pretty slim. – dirkt Jun 07 '17 at 07:20
  • @dirkt Then I could write a kernel driver... how would I address the port that way? Also what you say basically implies that the cable is completely useless, and that makes no sense. Also this certainly is not a hardware problem... my windows computer can actually recognize the connection to a linux computer via this cable. – Krupip Jun 07 '17 at 13:22
  • So you have connected two PCs under Windows this way? What information does the device manager give in this mode? As what kind of USB device does the host controller act? If you connect in to Linux, what do `lsusb` and `dmesg` say?I mean, if you got it to work under Windows, that's great news, and will give hints how to implement it in Linux. So please add details to your question. :-) The only usage I've seen for this cable type so far is for debug ports, so it's clearly not useless ... – dirkt Jun 07 '17 at 16:09
  • @dirkt A: I've gotten usb 3 crossover cables with custom software before to work with two windows devices. B: the current cable I'm using gets recognized by windows if I connect to a linux device, I do not have two windows devices atm. This does not mean I can natively transfer files however. C: Device manager screws up in linux connection and deletes/readds the device constantly, window to windows mode I never needed to check device manager, so i have no clue there. D: What are you on about? This also isn't about windows to linux. its about linux to linux. – Krupip Jun 07 '17 at 16:38
  • @dirkt E: I already told you want they said, nothing, they can't find anything. Theres just no entry point to go on from here on that end. F: No, the fact that something works on windows did not, in any way, give any hints on how it would work on linux. monitoring messages sent via wireshark physically can't help in this situation if that's what you were thinking. G: Debug ports, you mean via power? That alone isn't much debug help if you can't send information in any direction. – Krupip Jun 07 '17 at 16:39
  • Please add details to the question, this is all very vague, and nothing to work with. For starters, output of `lspci -nn` to identify the host adapter hardware, content of `dmesg` after you plug in the cable (with other plugged into windows machine), screenshots of the Properties window of the USB host adapter in the Windows device manager, all tabs if possible. With that information, I can at least google for datasheets. And yes, if something works under Windows, it gives a lot of hints. How do you think reverse engineered device drivers get written? – dirkt Jun 07 '17 at 17:10
  • Some slides that explain [Debug Ports](http://composter.com.ua/documents/USB-2.0-Debug-Port(John-Keys).pdf) (though for USB 2.0). `g_serial` is a USB gadget driver. It won't do anything unless the USB 3.0 host adapter somehow switches into gadget mode (which I seriously doubt). – dirkt Jun 07 '17 at 17:11
  • @dirkt No the question isn't vague. I want a linux usb host to act like a usb device or some way to send data from host to host via nominal usb communication. `lspci -nn` has too much to display here, what did you need from it? also `dmesg` displays even more, thousands of lines. But it does say `" usb usb4-port1: Cannot enable. Maybe the USB cable is bad? "` at least a thousand times which I assume because the other end is not a device port either. added windows output to main, again I never said I could file transfer or do anything useful. Also your link doesn't work. – Krupip Jun 07 '17 at 17:38
  • Judging from the error messages, your hardware doesn't support it all: You just get errors on both sides. So Windows **doesn't** "recognize your cable when connected to Linux". If you can show me a working Windows-to-Windows configuration with that cable, maybe one can figure out something from that, but from what you have right now, it just won't work. – dirkt Jun 07 '17 at 18:13

2 Answers2

0

I haven't tested this but according to USB3 debug port one can use an USB 3.x debug cable to set up a serial connection between two linux hosts. This would allow to e.g. run a PPP or SLIP connection on top of the ttys.

Renne
  • 1
0

Yes, it is possible. There's the "USB Gadget" project, and the "Linux IO Target" project. There appears to be a lot of talk about both these projects but very little on how to actually make it work.

MacGuffin
  • 346
  • 2
  • 7