5

I am trying to get my tablet serve as a screen with VNC connection. After few searches, they pointed me to include these lines to /etc/network/interfaces:

iface usb0 inet static
address 192.168.42.42
netmask 255.255.255.0
network 192.168.42.0
gateway 192.168.42.129
broadcast 192.168.42.255

Link to tutorial: http://rwhitmire.com/2014/03/25/android-tablet-raspberry-pi/

As the tutorial seems to be for model B, and my rPimodel is B+, I would like to ask if the usb0 is still correct, and how to determine which port on my B+ rPi is usb0.

dxbc
  • 53
  • 1
  • 1
  • 4
  • I didn't realise you could use USB in this fashion. Could you edit your post and include a link to the tutorial? – joan Nov 23 '14 at 12:57
  • Sure, i've included the link. – dxbc Nov 23 '14 at 13:17
  • @dxbc did you enable "USB Tethering" on your tablet? If you did, as you connect RPi to tablet through USB cable, you should able see your usb device name (usb0 or whatever) at your /var/log/messages. – gurcanozturk Nov 23 '14 at 15:00

2 Answers2

2

After you plug in the tablet and enable tethering, you should be able to see the interface with ip link:

> ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether b8:27:eb:2c:bd:8c brd ff:ff:ff:ff:ff:ff
3: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether a2:c2:f2:2c:9d:30 brd ff:ff:ff:ff:ff:ff

On a raspbian pi it will almost certainly be usb0. That's that.

If it's not there and modprobe cdc_ether fails, keep reading.

There is some kernel configuration that's critical to this; using the default raspbian should be fine, but if you've rolled your own you need the following options under Device Drivers -> Network Device Support -> USB Network Adapters:

  • Multi-purpose USB Networking Framework. This enables some more options, but chances are you already have it and SMSC LAN95XX based USB 2.0 10/100 ethernet devices enabled since that's required for basic ethernet on the pi. To this you must add:
    • CDC Ethernet support
    • CDC EEM support
    • CDC NCM support
    • Host for RNDIS and ActiveSync devices
    • Simple USB Network Links (CDC Ethernet subset). This has suboptions of its own; Embedded ARM Linux links (iPaq, ...) is then required.

These can be added as modules but when I did this using my last build tree (generally that's fine, you're just adding a module) they still refused to load; I had to rebuild the kernel as well. They now autoload when I plug in a device and enable tethering.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
2

How to fix the usb0 not showing up in ifconfig.

Make sure to do each step.

  • Connect data cable

  • Physically go and turn on usb tethering again. Mine shut off every time I plugged in the usb

  • Run ifconfig with tether turned on. You will see usb0 but it will probably have a different address.
  • Change the address in the VNC app to what is actually shown on the ifconfig print out

** Mine changed from 192.168.42.42 to 192.168.42.214. I left it at port 1, so 192.168.42.214:1 but they key here is that it’s not actually on 42.42 but something else.

That should fix it.

FYI I am on a raspberry pi 3 late 2017 and android 6.0 not that it matters.

Here is a picture of it working. https://pasteboard.co/GNj836W.jpg

If you have any questions feel free to reach out.

znon
  • 21
  • 1