You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/02/24 00:56:04 UTC

[GitHub] [incubator-nuttx] adamfeuer opened a new pull request #364: Ethernet over USB docs and helper scripts

adamfeuer opened a new pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364
 
 
   ### Summary
   
   * Adds defconfig for Ethernet over USB 2.0 High Speed that works reliably
   * Removes other redundant Ethernet over USB defconfigs
   * Improves Ethernet over USB helper script and moves it to tools
   * Updates SAMA5D3-Xplained README.txt to cover setup and usage
   
   ### Impact
   
   * None if you don't use the CDC ECM driver
   * CDC ECM driver can now do 4.4 MBytes/s (34 Mbits/s) on the SAMA5D3-Xplained
   
   ### Limitations / TODO
   
   * Reliability seems to depend on correct IOB configuration. This one was arrived at via trial and error.
   
   ### Testing
   
   * Via an improved tcpblaster, this will be submitted in another PR
   
   ### How To Verify 
   
   * Set up via the README.txt instructions and use tcpblaster to verify speed and ability to run for long times.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383066898
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
 
 Review comment:
   Add some description in tools/README.txt

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383066853
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
+# helper script - sets up nuttx to access 
+# the internet via a host route and 
+# IP tables.
+
+IP_NET="10.0.0.0/24"
+IP_NETMASK="255.255.255.0"
+IP_BROADCAST="10.0.0.255"
+IP_HOST="10.0.0.1"
+IP_NUTTX="10.0.0.2"
+
+if [ $# != 3 ]; then
+  echo "Usage: $0 <main-interface> <usb-net-interface> <on|off>"
+  exit 1
+fi
+
+IF_HOST=$1
+IF_USB=$2
+STATUS=$3
+
+net_off() {
+    ip route delete $IP_NET
+    ip route delete $IP_NUTTX/32
+
+    # delete nat rules to clean up
+    iptables -t nat -D POSTROUTING -o $IF_HOST -j MASQUERADE
+    iptables -D FORWARD -i $IF_HOST -o $IF_USB -m state --state RELATED,ESTABLISHED -j ACCEPT
+    iptables -D FORWARD -i $IF_USB -o $IF_HOST -j ACCEPT
+
+    ip route show
+    ifconfig $IF_USB down
+}
+
+if [ "$STATUS" == "on" ]; then
+    net_off
+    ifconfig $IF_USB up
+    ifconfig -a
+    ifconfig $IF_USB add $IP_HOST
+    ifconfig $IF_USB:0 broadcast $IP_BROADCAST netmask $IP_NETMASK
+    ip route delete $IP_NET
 
 Review comment:
   Remove, done in net_off

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383067661
 
 

 ##########
 File path: boards/arm/sama5/sama5d3-xplained/README.txt
 ##########
 @@ -1019,6 +1037,75 @@ Networking
       CONFIG_NSH_NETINIT_RETRYMSEC=2000     : Configure the network monitor as you like
       CONFIG_NSH_NETINIT_SIGNO=18
 
+
 
 Review comment:
   Remove the redundant blank line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383075807
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on issue #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on issue #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#issuecomment-590157938
 
 
   @xiaoxiang781216 Thanks for the improvements. It's night here in Seattle, I'll make the changes you suggested tomorrow. 🙂 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383076061
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
+# helper script - sets up nuttx to access 
+# the internet via a host route and 
+# IP tables.
+
+IP_NET="10.0.0.0/24"
+IP_NETMASK="255.255.255.0"
+IP_BROADCAST="10.0.0.255"
+IP_HOST="10.0.0.1"
+IP_NUTTX="10.0.0.2"
+
+if [ $# != 3 ]; then
+  echo "Usage: $0 <main-interface> <usb-net-interface> <on|off>"
+  exit 1
+fi
+
+IF_HOST=$1
+IF_USB=$2
+STATUS=$3
+
+net_off() {
+    ip route delete $IP_NET
+    ip route delete $IP_NUTTX/32
+
+    # delete nat rules to clean up
+    iptables -t nat -D POSTROUTING -o $IF_HOST -j MASQUERADE
+    iptables -D FORWARD -i $IF_HOST -o $IF_USB -m state --state RELATED,ESTABLISHED -j ACCEPT
+    iptables -D FORWARD -i $IF_USB -o $IF_HOST -j ACCEPT
+
+    ip route show
+    ifconfig $IF_USB down
+}
+
+if [ "$STATUS" == "on" ]; then
+    net_off
+    ifconfig $IF_USB up
+    ifconfig -a
+    ifconfig $IF_USB add $IP_HOST
+    ifconfig $IF_USB:0 broadcast $IP_BROADCAST netmask $IP_NETMASK
+    ip route delete $IP_NET
 
 Review comment:
   @xiaoxiang781216 Got it, will fix.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383065678
 
 

 ##########
 File path: boards/arm/sama5/sama5d3-xplained/README.txt
 ##########
 @@ -834,6 +836,21 @@ Networking
   PHY selection.  Later in the configuration steps, you will need to select
   the  KSZ9081 PHY for GMAC (See below)
 
+  Selecting Ethernet over USB (CDC ECM driver)
+  --------------------------------------------
+
+  This uses the USB 2.0 connector labeled USB-A. On the host computer you will
+  need to configure the CDC ECM driver.
+
+    CONFIG_USBDEV=y
+    CONFIG_USBDEV_DMA=y
+    CONFIG_USBDEV_DUALSPEED=y
+    CONFIG_NET_CDCECM=y
+    CONFIG_NET_ETH_PKTSIZE=1514
+
+  You can also use the defconfig file in `boards/arm/sama5/sama5d3-xplained/configs/ethernet-over-usb-2-high-speed`.
+
+
 
 Review comment:
   Remove the redundant blank line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383075822
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383590137
 
 

 ##########
 File path: boards/arm/sama5/sama5d3-xplained/README.txt
 ##########
 @@ -1019,6 +1036,74 @@ Networking
       CONFIG_NSH_NETINIT_RETRYMSEC=2000     : Configure the network monitor as you like
       CONFIG_NSH_NETINIT_SIGNO=18
 
+
+
+  Ethernet Over USB Configuration Script
+  --------------------------------------
+
+  There is a configuration script for Linux that will configure the USB Ethernet interface,
+  it is in `tools/netusb.sh`. You can use it as follows:
+
+  Once you boot a NuttX system with the
+  CDC ECM Ethernet over USB device, the Linux network interface will be added to your system. You should
+  see something like the following messages in /var/log/kern.log:
+
+   [302074.552879] usb 1-2: new high-speed USB device number 107 using ehci-pci
+   [302074.718264] usb 1-2: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 1.00
+   [302074.718267] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
+   [302074.718269] usb 1-2: Product: CDC/ECM Ethernet
+   [302074.718271] usb 1-2: Manufacturer: NuttX
+   [302074.718272] usb 1-2: SerialNumber: 0
+   [302074.760638] cdc_ether 1-2:1.0 usb0: register 'cdc_ether' at usb-0000:02:03.0-2, CDC Ethernet Device, 02:00:00:11:22:33
+   [302074.796215] cdc_ether 1-2:1.0 ens35u2: renamed from usb0
+
+  If you execute the command 'ifconfig -a' you should see a new interface:
+
+  $ ifconfig -a
+
+  ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
+          inet 192.168.46.156  netmask 255.255.255.0  broadcast 192.168.46.255
+          inet6 fe80::20c:29ff:fe57:d0f8  prefixlen 64  scopeid 0x20<link>
+          ether 00:0c:29:57:d0:f8  txqueuelen 1000  (Ethernet)
+          RX packets 7628014  bytes 2002078802 (2.0 GB)
+          RX errors 0  dropped 0  overruns 0  frame 0
+          TX packets 6040388  bytes 5327276865 (5.3 GB)
+          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
+
+  ens160u4u2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
+          inet6 fe80::ff:fe11:2233  prefixlen 64  scopeid 0x20<link>
+          ether 02:00:00:11:22:33  txqueuelen 1000  (Ethernet)
+          RX packets 36798  bytes 51705300 (51.7 MB)
+          RX errors 0  dropped 0  overruns 0  frame 0
+          TX packets 24196  bytes 1312512 (1.3 MB)
+          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
+
+  ens33 is the host Ethernet or wireless LAN interface. ens160u4u2 is the USB Ethernet
+  interface.
+
+  The script will bring up the interface, configure it, and set up routes and IP Tables rules so the
+  nuttx system can access the internet:
+
+  $ sudo ./tools/netusb.sh ens33 ens160u4u2 on
+
+  This will bring down the interface, configure it, and delete routes and IP Tables rules:
+
+  $ sudo ./tools/netusb.sh ens33 ens160u4u2 off
+
+  Now that the new interface has an IP address, you can ping the NuttX box at 10.0.0.2
+  (or whatever IP address you configured it to have). If you used the telnet defconfig,
+  you should be able to telnet to the board using:
+
+  $ telnet 10.0.0.2
+
+  The helper script also sets up Network Address Translation (NAT) so the NuttX system
+  can access the Internet. If that is not what you want, you can remove the iptables
+  NAT commands from the script.
+
+
+
+
+
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383075766
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
+# helper script - sets up nuttx to access 
+# the internet via a host route and 
+# IP tables.
+
+IP_NET="10.0.0.0/24"
+IP_NETMASK="255.255.255.0"
+IP_BROADCAST="10.0.0.255"
+IP_HOST="10.0.0.1"
+IP_NUTTX="10.0.0.2"
+
+if [ $# != 3 ]; then
+  echo "Usage: $0 <main-interface> <usb-net-interface> <on|off>"
+  exit 1
+fi
+
+IF_HOST=$1
+IF_USB=$2
+STATUS=$3
+
+net_off() {
+    ip route delete $IP_NET
+    ip route delete $IP_NUTTX/32
+
+    # delete nat rules to clean up
+    iptables -t nat -D POSTROUTING -o $IF_HOST -j MASQUERADE
+    iptables -D FORWARD -i $IF_HOST -o $IF_USB -m state --state RELATED,ESTABLISHED -j ACCEPT
+    iptables -D FORWARD -i $IF_USB -o $IF_HOST -j ACCEPT
+
+    ip route show
+    ifconfig $IF_USB down
+}
+
+if [ "$STATUS" == "on" ]; then
+    net_off
+    ifconfig $IF_USB up
+    ifconfig -a
+    ifconfig $IF_USB add $IP_HOST
+    ifconfig $IF_USB:0 broadcast $IP_BROADCAST netmask $IP_NETMASK
+    ip route delete $IP_NET
+    ip route add $IP_NET dev $IF_USB src $IP_HOST
+    ip route add $IP_NUTTX/32 dev $IF_USB src $IP_HOST
+
+    # nat to allow NuttX to access the internet
+    iptables -t nat -A POSTROUTING -o $IF_HOST -j MASQUERADE
+    iptables -A FORWARD -i $IF_HOST -o $IF_USB -m state --state RELATED,ESTABLISHED -j ACCEPT
+    iptables -A FORWARD -i $IF_USB -o $IF_HOST -j ACCEPT
+
+    ip route show
+    ping -c 1 $IP_NUTTX
+else
+    net_off
+fi
+
+
+
+
+
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383066271
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
+# helper script - sets up nuttx to access 
+# the internet via a host route and 
+# IP tables.
+
+IP_NET="10.0.0.0/24"
+IP_NETMASK="255.255.255.0"
+IP_BROADCAST="10.0.0.255"
+IP_HOST="10.0.0.1"
+IP_NUTTX="10.0.0.2"
+
+if [ $# != 3 ]; then
+  echo "Usage: $0 <main-interface> <usb-net-interface> <on|off>"
+  exit 1
+fi
+
+IF_HOST=$1
+IF_USB=$2
+STATUS=$3
+
+net_off() {
+    ip route delete $IP_NET
 
 Review comment:
   use two spaces indent

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383065711
 
 

 ##########
 File path: boards/arm/sama5/sama5d3-xplained/README.txt
 ##########
 @@ -1019,6 +1036,74 @@ Networking
       CONFIG_NSH_NETINIT_RETRYMSEC=2000     : Configure the network monitor as you like
       CONFIG_NSH_NETINIT_SIGNO=18
 
+
+
+  Ethernet Over USB Configuration Script
+  --------------------------------------
+
+  There is a configuration script for Linux that will configure the USB Ethernet interface,
+  it is in `tools/netusb.sh`. You can use it as follows:
+
+  Once you boot a NuttX system with the
+  CDC ECM Ethernet over USB device, the Linux network interface will be added to your system. You should
+  see something like the following messages in /var/log/kern.log:
+
+   [302074.552879] usb 1-2: new high-speed USB device number 107 using ehci-pci
+   [302074.718264] usb 1-2: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 1.00
+   [302074.718267] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
+   [302074.718269] usb 1-2: Product: CDC/ECM Ethernet
+   [302074.718271] usb 1-2: Manufacturer: NuttX
+   [302074.718272] usb 1-2: SerialNumber: 0
+   [302074.760638] cdc_ether 1-2:1.0 usb0: register 'cdc_ether' at usb-0000:02:03.0-2, CDC Ethernet Device, 02:00:00:11:22:33
+   [302074.796215] cdc_ether 1-2:1.0 ens35u2: renamed from usb0
+
+  If you execute the command 'ifconfig -a' you should see a new interface:
+
+  $ ifconfig -a
+
+  ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
+          inet 192.168.46.156  netmask 255.255.255.0  broadcast 192.168.46.255
+          inet6 fe80::20c:29ff:fe57:d0f8  prefixlen 64  scopeid 0x20<link>
+          ether 00:0c:29:57:d0:f8  txqueuelen 1000  (Ethernet)
+          RX packets 7628014  bytes 2002078802 (2.0 GB)
+          RX errors 0  dropped 0  overruns 0  frame 0
+          TX packets 6040388  bytes 5327276865 (5.3 GB)
+          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
+
+  ens160u4u2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
+          inet6 fe80::ff:fe11:2233  prefixlen 64  scopeid 0x20<link>
+          ether 02:00:00:11:22:33  txqueuelen 1000  (Ethernet)
+          RX packets 36798  bytes 51705300 (51.7 MB)
+          RX errors 0  dropped 0  overruns 0  frame 0
+          TX packets 24196  bytes 1312512 (1.3 MB)
+          TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
+
+  ens33 is the host Ethernet or wireless LAN interface. ens160u4u2 is the USB Ethernet
+  interface.
+
+  The script will bring up the interface, configure it, and set up routes and IP Tables rules so the
+  nuttx system can access the internet:
+
+  $ sudo ./tools/netusb.sh ens33 ens160u4u2 on
+
+  This will bring down the interface, configure it, and delete routes and IP Tables rules:
+
+  $ sudo ./tools/netusb.sh ens33 ens160u4u2 off
+
+  Now that the new interface has an IP address, you can ping the NuttX box at 10.0.0.2
+  (or whatever IP address you configured it to have). If you used the telnet defconfig,
+  you should be able to telnet to the board using:
+
+  $ telnet 10.0.0.2
+
+  The helper script also sets up Network Address Translation (NAT) so the NuttX system
+  can access the Internet. If that is not what you want, you can remove the iptables
+  NAT commands from the script.
+
+
+
+
+
 
 Review comment:
   Remove the redundant blank line too.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383075829
 
 

 ##########
 File path: boards/arm/sama5/sama5d3-xplained/README.txt
 ##########
 @@ -1019,6 +1037,75 @@ Networking
       CONFIG_NSH_NETINIT_RETRYMSEC=2000     : Configure the network monitor as you like
       CONFIG_NSH_NETINIT_SIGNO=18
 
+
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on issue #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on issue #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#issuecomment-590623313
 
 
   @xiaoxiang781216 I made the requested improvements, rebased, and force-pushed the branch. Will you check it out to see if there are more changes you'd like to see?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383067048
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
 
 Review comment:
   Add apache copyright, like tools/zds/zdsar.c

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383075737
 
 

 ##########
 File path: boards/arm/sama5/sama5d3-xplained/README.txt
 ##########
 @@ -834,6 +836,21 @@ Networking
   PHY selection.  Later in the configuration steps, you will need to select
   the  KSZ9081 PHY for GMAC (See below)
 
+  Selecting Ethernet over USB (CDC ECM driver)
+  --------------------------------------------
+
+  This uses the USB 2.0 connector labeled USB-A. On the host computer you will
+  need to configure the CDC ECM driver.
+
+    CONFIG_USBDEV=y
+    CONFIG_USBDEV_DMA=y
+    CONFIG_USBDEV_DUALSPEED=y
+    CONFIG_NET_CDCECM=y
+    CONFIG_NET_ETH_PKTSIZE=1514
+
+  You can also use the defconfig file in `boards/arm/sama5/sama5d3-xplained/configs/ethernet-over-usb-2-high-speed`.
+
+
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
adamfeuer commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383075790
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
+# helper script - sets up nuttx to access 
+# the internet via a host route and 
+# IP tables.
+
+IP_NET="10.0.0.0/24"
+IP_NETMASK="255.255.255.0"
+IP_BROADCAST="10.0.0.255"
+IP_HOST="10.0.0.1"
+IP_NUTTX="10.0.0.2"
+
+if [ $# != 3 ]; then
+  echo "Usage: $0 <main-interface> <usb-net-interface> <on|off>"
+  exit 1
+fi
+
+IF_HOST=$1
+IF_USB=$2
+STATUS=$3
+
+net_off() {
+    ip route delete $IP_NET
 
 Review comment:
   @xiaoxiang781216 will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #364: Ethernet over USB docs and helper scripts
URL: https://github.com/apache/incubator-nuttx/pull/364#discussion_r383066045
 
 

 ##########
 File path: tools/netusb.sh
 ##########
 @@ -0,0 +1,61 @@
+#!/bin/bash
+set -x
+
+# USB Ethernet Gadget interface
+# helper script - sets up nuttx to access 
+# the internet via a host route and 
+# IP tables.
+
+IP_NET="10.0.0.0/24"
+IP_NETMASK="255.255.255.0"
+IP_BROADCAST="10.0.0.255"
+IP_HOST="10.0.0.1"
+IP_NUTTX="10.0.0.2"
+
+if [ $# != 3 ]; then
+  echo "Usage: $0 <main-interface> <usb-net-interface> <on|off>"
+  exit 1
+fi
+
+IF_HOST=$1
+IF_USB=$2
+STATUS=$3
+
+net_off() {
+    ip route delete $IP_NET
+    ip route delete $IP_NUTTX/32
+
+    # delete nat rules to clean up
+    iptables -t nat -D POSTROUTING -o $IF_HOST -j MASQUERADE
+    iptables -D FORWARD -i $IF_HOST -o $IF_USB -m state --state RELATED,ESTABLISHED -j ACCEPT
+    iptables -D FORWARD -i $IF_USB -o $IF_HOST -j ACCEPT
+
+    ip route show
+    ifconfig $IF_USB down
+}
+
+if [ "$STATUS" == "on" ]; then
+    net_off
+    ifconfig $IF_USB up
+    ifconfig -a
+    ifconfig $IF_USB add $IP_HOST
+    ifconfig $IF_USB:0 broadcast $IP_BROADCAST netmask $IP_NETMASK
+    ip route delete $IP_NET
+    ip route add $IP_NET dev $IF_USB src $IP_HOST
+    ip route add $IP_NUTTX/32 dev $IF_USB src $IP_HOST
+
+    # nat to allow NuttX to access the internet
+    iptables -t nat -A POSTROUTING -o $IF_HOST -j MASQUERADE
+    iptables -A FORWARD -i $IF_HOST -o $IF_USB -m state --state RELATED,ESTABLISHED -j ACCEPT
+    iptables -A FORWARD -i $IF_USB -o $IF_HOST -j ACCEPT
+
+    ip route show
+    ping -c 1 $IP_NUTTX
+else
+    net_off
+fi
+
+
+
+
+
 
 Review comment:
   Remove the redundant blank line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services