ModBros / mobro-raspberrypi

Official Raspberry Pi image of MoBro
GNU General Public License v3.0
77 stars 7 forks source link

Initial release of USB gadget mode #6

Closed stanoba closed 3 years ago

stanoba commented 3 years ago

This PR should cover issue #1

Main changes:

Note: USB Gadget is compatible with Raspberry Pi 0, 0W, A, A+, and 4 only. (Pi B, B+, 2, 3, 3A+, and 3B+ lack the required pin for OTG)

stanoba commented 3 years ago

Raspberry Pi Zero W + 3.5" TFT display. It has disabled WiFi and only one cable is attached:

LCD_img1 LCD_img2

EnDeRWiGiN commented 3 years ago

Any way I could help test this?

stanoba commented 3 years ago

Any way I could help test this?

Hi @EnDeRWiGiN, I think yes, but you need to update your code on SD card.

Here are steps that you need to follow:

  1. Connect Raspberry Pi to internet (needed for installation).

  2. Rename folder mobro-raspberrypi to mobro-raspberrypi_old and display-drivers folder to display-drivers_old:

    
    mv mobro-raspberrypi mobro-raspberrypi_old
    mv display-drivers display-drivers_old

3. Clone my `mobro-raspberrypi` fork and run installation script:
```sh
cd /home/modbros
git clone https://github.com/stanoba/mobro-raspberrypi.git
cd mobro-raspberrypi
chmod +x install.sh
sudo ./install.sh

Note: This step is better to do on RPI3 or RPI4 as Zero could be quite slow. After installation you can put SD card back to Zero.

  1. Re-connect raspberry to your computer via USB port (not PWR).

  2. Wait until boots, you should see new network interface in you computer.

  3. Set IP address and net-mask to your new interface e.g. 192.168.7.10/255.255.255.0

  4. Open http://192.168.7.2 in your browser and go through wizard.

  5. After reboot, everything should be working.

EnDeRWiGiN commented 3 years ago

Okay, so I followed your instruction and was able to do steps 1-3 smoothly. There was a problem once I tried to connect over USB. I was getting a "USB could not be deciphered" problem.

Knowing that it might be a config problem I checked the config.txt file and cmdline.txt. The config file was correct and had "dtoverlay=dwc2" but the cmdline.txt file did not have "modules-load=dwc2,g_ether" after rootwait. I added this and was able to proceed.

I was able to do steps 4-8 but afterward, the PI did not see the server even though I could go to the configurator and SSH into it.

I was able to set the network to private and ran the configuration multiple times but I could not get the Pi to see the modbros Client. I tried the static IP of the computer on that network adapter and the normal Network name but it could not find the client.

I ended up removing all the firewall rules and reinstalling modbros and I got it to work! (I have a feeling I messed up the firewall rules while tried to get other things working)

TLDR:

Seraksab commented 3 years ago

Thanks for putting in the work to implement this feature @stanoba 👍

I'll have a look at all of it once i find time to do so. But i I guess it will take a bit of time as I want to test it on multiple Pi models and make sure it doesn't interfere with normal network operation (wifi, ethernet) on the models that doesn't support OTG

Also we will need to update all of those Waveshare configuration files.. :/

Ezero03 commented 3 years ago

Hi, every time I follow this guide I get the exact same log and Windows cant recognice my raspberry with conected USB, althoug modbros app finds it and it works through wifi, not USB. Attached the installation log, so if there is any error, somebody can help me.

modbros_ssh_log.txt

EnDeRWiGiN commented 3 years ago

@Ezero03 Did you make sure the config.txt file and the cmdline.txt file had correct lines to enable the USB port to become a network adapter?

Did you try the items in my post:

Okay, so I followed your instruction and was able to do steps 1-3 smoothly. There was a problem once I tried to connect over USB. I was getting a "USB could not be deciphered" problem.

Knowing that it might be a config problem I checked the config.txt file and cmdline.txt. The config file was correct and had "dtoverlay=dwc2" but the cmdline.txt file did not have "modules-load=dwc2,g_ether" after rootwait. I added this and was able to proceed.

I was able to do steps 4-8 but afterward, the PI did not see the server even though I could go to the configurator and SSH into it.

I was able to set the network to private and ran the configuration multiple times but I could not get the Pi to see the modbros Client. I tried the static IP of the computer on that network adapter and the normal Network name but it could not find the client.

I ended up removing all the firewall rules and reinstalling modbros and I got it to work! (I have a feeling I messed up the firewall rules while tried to get other things working)

TLDR:

  • Add "modules-load=dwc2,g_ether" to cmdline.txt file
  • Make sure the new network interface has the PI's IP for the gateway. This way it is recognized as a valid network and you can set it to public or private.
  • Make sure the modbros application is configured properly with the firewall rules.
  • Enjoy! Thank you stanoba