New guide: StereoPi used as USB device

StereoPi hardware discussion
Post Reply
User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

New guide: StereoPi used as USB device

Post by Realizator »

Today we've published new article: USB gadget mode and network over USB.
Now you can access StereoPi over network using just one USB-micro USB cable. One more feature of our micro USB port is described (USB gadget mode).
Eugene a.k.a. Realizator

Blinky
Posts: 38
Joined: Wed May 01, 2019 11:18 pm

Re: New guide: StereoPi used as USB device

Post by Blinky »

Help! 169.254.x.x is the only address for the gadget i can get. Used a new install of SLP, with an unlocked the file system, changed the 4 files and repeated using both an updated windows machine and an updated rpi4 with dnsmasq installed as hosts, trying many times yet I am unable to repeat your results. The windows machine recognizes the gadget but the 169.254 address assigned loops back to the host not the gadget. The rpi4 also has a 169.254 address. I copied and pasted the examples and followed the trouble shooting as best as I could.

stereomaton
Posts: 215
Joined: Tue May 21, 2019 12:33 pm
Location: France

Re: New guide: StereoPi used as USB device

Post by stereomaton »

These addresses are the APIPA range, which denotes that the PC cannot communicate with the DHCP server.

If I understand well, you used the StereoPi as device in both cases, and a Windows PC as host, and then a RPi4 as host because the first case did not work. In both cases, you got APIPA address on the usb-network interface of your host.

If the network interface is created on the host, it is that both USB-device mode is set on the hardware and USB-gadget is loaded in the kennel. Good news, it's the hardest part and half of the operations.

So now, either your board do not have set is own IP (and dnsmasq thus has troubles to start), either the IP is set but dnsmasq has other troubles, or neither the IP nor dnsmasq work.

As a first step, let's assume that the IP is set. If you force a manual IP on your host, for example 192.168.3.2 with 255.255.255.0 as network mask, you should be able to ping the board and even connect with SSH with the 192.168.3.1 static address defined for it.
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras

Blinky
Posts: 38
Joined: Wed May 01, 2019 11:18 pm

Re: New guide: StereoPi used as USB device

Post by Blinky »

Started with a fresh flash of SLP, unlocked the file system and changed the files as per the article.

Set windows to assign 192.168.3.2 to the gadget with netmask 255.255.255.0. as you suggested and the Ping was successful, however with SSH 192.168.3.1 times out and the gadget at 192.168.3.2 refuses to connect. When a browser attempts to connect, .3.1 times out and .3.2 refuses. Turning off the firewall did not help.

On Rpi set the usb0 to 192.168.3.2, netmask was not available, the result being the Ping was successful, however browser could not reach 192.168.3.1 and 192.168.3.2 refused to connect. The SSH to .3.1 could not find a route to host. SSH to .3.2 was able to initiate a login to root but the password was not accepted.
Last edited by Blinky on Sat Apr 25, 2020 5:47 pm, edited 1 time in total.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: New guide: StereoPi used as USB device

Post by Realizator »

Blinky, could you please check power issue?
Please try to use a good micro USB cable (if you have one from your phone - use it). Also try to connect HDMI to the StereoPi.
My suggestion: low power on micro USB. May be you are using USB 2.0 port on your PC. So if you do a ping, it works. But accessing admin panel (web) requires more power for processing, and StereoPi can just reboot. So if you have HDMI connected, you can see if it goes to reboot or not.
Several days ago we discussed strange StereoPi behavior with user HASSAN MEHMOOD - black screen, errors while boot etc. After all, problem was localized - poor power.

Second suggestion: please check, if cameras are connected correctly. If livestream to the browser is enabled, our scripts try to initiate livestream and (sometimes) do network reinitiation. So if one of the camera has poor connection, you can get "fall out from network" situation. We plan to fix this issue in the next SLP release.
Eugene a.k.a. Realizator

Blinky
Posts: 38
Joined: Wed May 01, 2019 11:18 pm

Re: New guide: StereoPi used as USB device

Post by Blinky »

I am using the light blue USB ports on both the windows box and the rpi. I noticed a cabling issue earlier when the gadget would not appear at all in the network, but i had tried to use a cable with a built in power switch instead of my trusty goto cables. My trusty ones have a ecomoto green tag and came with a Motorola Zoom almost 10 years ago. I ordered more on ebay and they have never failed me. But I tried a couple of others including a thick shorty used to charge power blocks and the cables and power seem okay.

The hdmi signal doesn't falter when the browser is refused connection.

Cameras are fine in the hdmi output.
Last edited by Blinky on Sat Apr 25, 2020 7:48 pm, edited 1 time in total.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: New guide: StereoPi used as USB device

Post by Realizator »

Blinky, did you try to repeat this experiment with a stock Raspbian Buster? Do not forget to enable SSH while basic configuration.
If the problem remains - we'll try to understand, what is globally wrong. If it will work with the stock Buster - we'll try to figure out, what's wrong with your SLP configuration. As a last test I can do all settings on my side (SLP), test it, and give you my configured SLP image for download to test, if it works on your hardware. Both for me and Stereomaton it works out of the box. I also tested it on MacOS.
By the way, if your pings are stable?
Did you installed drivers under Windows?
Which Windows version you are using?
Eugene a.k.a. Realizator

Blinky
Posts: 38
Joined: Wed May 01, 2019 11:18 pm

Re: New guide: StereoPi used as USB device

Post by Blinky »

I removed the pi-=hole from the system in case that was the issue. I do not think it was.

The rpi is fresh and it SSH's to other computers and can be accessed similarily.

The up-to-date windows 10 machine has a ping to the assigned 192.168.3.2 address of <1ms or 0 avg.

5 pings with min .074 ms, max .12 ms from the rpi pinging the stereo pi over usb0's asigned ip address.

I did not install the windows driver because the gadget was recognized as a network and not a com port.

The article does not mention setting the host's ip address yet there is only a 169.254 address for the new network unless the host presets the 192.168.3.X which is only pingable ergo questionable, (I think it is pinging itself).

The house router asigns fixed ip's to a number of machines, but I have a range of ip's which are assigned by router, these are the ones used in this project.

When the host rpi asigns 192.168.3.1, I noticed when hovering the mouse over the taskbar network indicator, that the usb0 link is up, configuring, and does not change and stop the configuration process to indicate the ip address like it does when it generates the 169.255 address when the host does not asign an address.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: New guide: StereoPi used as USB device

Post by Realizator »

Blinky, could you please check content of "/etc/network/interfaces.d/usb0" file?
I found a typo in an article. Current text is:

Code: Select all

auto usb0 
allow-hotplug usb0 
iface usb0 inet static 
    address 192.168.3.1 
    netmask 255.255.3.0 
    network 192.168.3.0 
    broadcast 192.168.3.255
So "netmask 255.255.3.0" is a definitely typo - it should be "netmask 255.255.255.0"
Please check this.
p.s. I already fixed this typo in our blog and on Medium blog too.
Eugene a.k.a. Realizator

Blinky
Posts: 38
Joined: Wed May 01, 2019 11:18 pm

Re: New guide: StereoPi used as USB device

Post by Blinky »

Mystery solved. Thank you for an interesting foray into the world of dns/dhcp addressing.

Kind regards,
Blinky

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: New guide: StereoPi used as USB device

Post by Realizator »

I'm glad it works now! :D Sorry for this typo.
Am I right understand, that you are planning to use the StereoPi as a camera, and the RPi4 as more powerful device for the image processing, connecting them over USB ethernet?
Eugene a.k.a. Realizator

stereomaton
Posts: 215
Joined: Tue May 21, 2019 12:33 pm
Location: France

Re: New guide: StereoPi used as USB device

Post by stereomaton »

I come back to the forum after you had a long discussion.
I did not understand well how was the setup and I have the feeling that there was a confusion in the addresses to ping, but fortunately the problem is solved.
When I tested it, I changed this file from an already existing one I had on my setup (not fresh install) and did not see this typo in the article. Good catch.
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras

Blinky
Posts: 38
Joined: Wed May 01, 2019 11:18 pm

Re: New guide: StereoPi used as USB device

Post by Blinky »

The goal was to add a webcam to my new desktop computer. This was accomplished in two ways.

First using the Stereopi as stock SLP out of the box and Manycam to redirect the browsers output to both Skype and a Flash based system used in browsers.

Secondly using the Stereopi via a usb connection and again having Manycam to do the redirection of the video stream.

Using Manycam means having to reconnect to the browser window each time, but why buy a new webcam when there is a tool available.

Tried to use your OBS and the Gstream method but ran into two problems, the Gstream method always had distracting frame rate and other info, and with OBS version 25 and the recommended plugin, I could not get the output from the preview to the input or output, but that is probably due to my naivete with both.

Would be doing more with Blinky and Perky but the parts I ordered in late Febuary have not made it yet ... esp32's change everything.

Have a great day and thanks again for the stereopi development.

Kind regards,
Blinky
Last edited by Blinky on Thu Apr 30, 2020 5:49 pm, edited 1 time in total.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: New guide: StereoPi used as USB device

Post by Realizator »

Hi Blinky,
Thank you for your task clarification!
May be you've already seen our experiment of using StareoPi as a Skype camera here using OBS.
Alse there is an experiment of using Pi Zero as USB webcam in a USB gadget mode. But this method looks very unstable, so we decided not to implement it in SLP now. But in the future, if we'll find a stable way, we add it to the "stock" SLP.
Eugene a.k.a. Realizator

Post Reply