User:Arokux

From linux-sunxi.org
Jump to navigation Jump to search

Buildroot

NOTE: You need to set BR2_TOOLCHAIN_EXTERNAL_PATH properly.
It includes some firmware, you might want to delete it. First, make sure it builds and boots, then you make it even slimer.

State of the art of the Dual Role USB Controller (USB OTG) on sunxi-3.4

  • Allwinner code
  • automatic switching between host and gadget mode works
  • works in gadget mode with g_ether (does not work with g_cdc). You need to plug USB cable twice. Network interfaces must be configured with ifconfig/route. It will NOT work if configured with ip from iproute2.
  • works in host mode
  • musb-sunxi (musb with sunxi glue)
  • automatic switching between host and gadget mode DOES NOT work
  • works in device with g_cdc or g_ether. For g_ether network interfaces must be configured with ifconfig/route. It will NOT work if configured with ip from iproute2.
  • works in host mode

Setting up network channel with ifconfig/route

#on board
IP_HOST=192.168.0.123
IP_BOARD=192.168.0.124
ifconfig usb0 $IP_BOARD netmask 255.255.255.0
route add default gw $IP_HOST
route
#on host
IP_HOST=192.168.0.123
sudo ifconfig usb0 $IP_HOST netmask 255.255.255.0

Setting up network channel with ip

#on board
IP_HOST=192.168.0.123
IP_BOARD=192.168.0.124
ip address add $IP_BOARD/24 dev usb0
ip link set usb0 up
ip route add default via $IP_HOST
#on host
IP_HOST=192.168.0.123
sudo ip address add $IP_HOST/24 dev usb0

ip cheatsheet

$ ip addr #show all addresses
$ ip -s link show eth0 #statistics for eth0
$ ip route
$ ip link set eth0 up #or down
$ ip address add $IP/24 dev eth0
$ ip route add default via $GW_IP #default route

Debian/Ubuntu ip cheat sheet (without NM)

Host interfaces(5)

allow-hotplug usb0
iface usb0 inet static
 address 10.11.12.13
 netmask 255.255.255.0

Host bridged

allow-hotplug usb0
iface usb0 inet manual
 pre-up ifconfig usb0 up
 post-up brctl addif bridge usb0
iface bridge inet static
 bridge_ports some_interface another_interface
 address 10.11.12.13
 netmask 255.255.255.0
 # faster bridge startup - useful with dhcp
 post-up brctl setfd bridge 3


Device interfaces(5)

allow-hotplug usb0
iface usb0 inet static
 address 10.11.12.14
 netmask 255.255.255.0
 gateway 10.11.12.13

Device resolv.conf(5)

nameserver 10.11.12.13
nameserver 8.8.8.8

Useful info

/sys/kernel/debug/clk/clk_summary