[TriLUG] USB communication
Brian via TriLUG
trilug at trilug.org
Tue Oct 25 11:24:34 EDT 2016
Seems like my reply from work is stuck in limbo...so:
Hi Brian,
I have some thoughts that may be helpful.
As you probably already know, at a given moment, a USB-connected device
is either a "host" or a "device". In all cases that I'm aware of,
Type-A ports (such as on your computer) are always Host ports, and all
other ports (with the exception of Micro-AB) are Device ports. This is
by design. The exception is the Micro-AB port, which is the only port
which supports the USB On The Go (OTG) spec, allowing a Device to behave
as a Host (e.g. plugging a camera into a phone).
lsusb will never show you the "input" port because you have a case of
Host-Host, which just doesn't work. In order for the host PC to send
USB packets to the widget, the widget *must* present itself as a device
to the PC. In other words, the widget must behave differently (because
it is in a different role in the USB protocol).
If this is an off-the-shelf widget of some sort, you'll have to get a
third doohickey (technical term) to allow your PC to pretend to be a
device (which it can't do on its own and be in spec). This third
doohickey would look like a device to both hosts: it would implement the
HID spec for mouse for the widget, and probably act as a serial port to
the host PC.
Where to get that doohickey, other than cobbling one up yourself with,
for example, an Arduino and an FTDI USB-serial chip, I can't say.
Glad to assist further if you've got questions.
-Brian
On 10/24/2016 02:52 PM, Brian McCullough via TriLUG wrote:
> Folks,
>
> I am working on a new project, started last week, and am running into
> some questions.
>
> Not having much experience with USB hardware or the programming thereof,
> I am likely not either asking the right questions or understanding what
> I am finding.
>
>
>
> I am attempting to create a sort of test rig, using my laptop, for a
> device that has two USB ports.
>
> One of the ports expects to have a WiFi dongle plugged in, attached to a
> wireless mouse, and the other has a cable attached to a computer, acting
> as the same wireless mouse to that computer.
>
> What I would like to do is to plug a cable from the first port to a USB
> port on my laptop, and a second cable from the second port to a second
> port on the same laptop.
>
> The goal is to send a signal to the "input" port and measure that signal
> coming out of the "output" port. ( the codes that the mouse sends to the
> computer )
>
> When I plug this device into my laptop, I do see the "output" port
> appearing in lsusb, but not the "input" port. I am obviously missing
> something, and need some guidance which may include a primer on how to
> make all of this work.
>
> My intent was to use what I have read, in the way of documentation and
> example code, to write a program in Python, using the PyUSB library, to
> generate the "input" codes and read the "output" result, comparing them.
>
> However, if I can't send the "input" codes to the device, that plan has
> a small flaw.
>
>
>
> Any suggestions, help, pointers to How-Tos?
>
>
> Thanks,
> Brian ( the other one! )
>
>
More information about the TriLUG
mailing list