tcoder
Posts: 20
Joined: Sun Sep 18, 2016 5:05 pm

What USB port to use?

Wed Oct 12, 2016 6:37 pm

I have a Pi Zero connected to a 4 port USB hub. One port goes to a Wifi dongle, another goes to a keyboard and another goes to a mouse dongle. The last port goes to a Windows PC. I'm trying to communicate with the Windows PC using C++ but don't know how to access that port. I'm using WiringPi to open the port using serialOpen("/dev/ttyxxxx", 9600); My question is: what would I use as a device? I looked at the /dev/ directory and only see tty0-tty63 along with ttyAMA0 (which is the serial port).

Terry

fruitoftheloom
Posts: 23549
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: What USB port to use?

Wed Oct 12, 2016 6:40 pm

tcoder wrote:I have a Pi Zero connected to a 4 port USB hub. One port goes to a Wifi dongle, another goes to a keyboard and another goes to a mouse dongle. The last port goes to a Windows PC. I'm trying to communicate with the Windows PC using C++ but don't know how to access that port. I'm using WiringPi to open the port using serialOpen("/dev/ttyxxxx", 9600); My question is: what would I use as a device? I looked at the /dev/ directory and only see tty0-tty63 along with ttyAMA0 (which is the serial port).

Terry
What cable are you using to connect to the Windows PC ??
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot) RaspiOS64 ARM64
Asus ChromeBox 3 Celeron is my other computer...

tcoder
Posts: 20
Joined: Sun Sep 18, 2016 5:05 pm

Re: What USB port to use?

Wed Oct 12, 2016 8:44 pm

It's a USB 2.0 type A connector on both ends.

fruitoftheloom
Posts: 23549
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: What USB port to use?

Wed Oct 12, 2016 9:31 pm

tcoder wrote:It's a USB 2.0 type A connector on both ends.
Well that is not going to work....

..USB is a general purpose host-to-device (master-to-slave) I/O bus protocol, and you are connecting 2 Hosts together :?
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot) RaspiOS64 ARM64
Asus ChromeBox 3 Celeron is my other computer...

tcoder
Posts: 20
Joined: Sun Sep 18, 2016 5:05 pm

Re: What USB port to use?

Thu Oct 13, 2016 1:45 am

Maybe have something that can act as a slave to both the RPi and the PC. Thanks for setting me straight.

fruitoftheloom
Posts: 23549
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: What USB port to use?

Thu Oct 13, 2016 6:35 am

tcoder wrote:Maybe have something that can act as a slave to both the RPi and the PC. Thanks for setting me straight.
??????????? https://learn.adafruit.com/adafruits-ra ... e?view=all
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot) RaspiOS64 ARM64
Asus ChromeBox 3 Celeron is my other computer...

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: What USB port to use?

Thu Oct 13, 2016 6:41 am

The only USB devices which can be used to connect a
host and another host sensibly together to exchange data
are those "PC-Link" cables which obviously must contain
active electronics. Those do NOT emulate serial ports.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

tcoder
Posts: 20
Joined: Sun Sep 18, 2016 5:05 pm

Re: What USB port to use?

Thu Oct 13, 2016 2:01 pm

I think that intercepting keyboard input is the way to go. My device only has an LCD module to display messages and I need some way for the user to send configuration info so I can configure a Wifi module.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: What USB port to use?

Fri Oct 14, 2016 8:52 am

Using a USB-TTL-UART adaptor sounds like a sensible option in that context.
But i would simply connect the USB end to my laptop/desktop and the jumper wires
to the Pi instead of the other way round.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

tcoder
Posts: 20
Joined: Sun Sep 18, 2016 5:05 pm

Re: What USB port to use?

Fri Oct 14, 2016 1:25 pm

I've already built the prototype circuit board and the only user accessible method is via a USB port. I needed it to be user friendly and not have to use a DB-9 connector or something antiquated. The USB port was the only technically current method to enter data into the device. I'm thinking of having the Wifi as an access point instead.

Return to “C/C++”