maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 USB networking not working properly (https://talk.maemo.org/showthread.php?t=36665)

a1291762 2009-12-10 23:51

N900 USB networking not working properly
 
I followed the instructions here: http://wiki.maemo.org/N900_USB_networking

This gets me a USB networking connection between the N900 and my desktop. I also setup the desktop to allow the N900 to connect out. Testing reveals that this is all working as it should:
- I can ssh from the desktop machine to the N900.
- I can ssh from the N900 to a machine elsewhere on the internet.

What I can't do though is use any GUI app that needs network access because Maemo thinks there is no network access. It wants me to select a network to connect to and if I don't pick one then none of the apps even try to connect.

Does anyone know how to fix this?

I think perhaps I need to instruct Maemo that there is a new type of network connection that it can use that isn't WLAN/3G/EDGE but I don't know how to do that.

a1291762 2009-12-11 04:12

Re: N900 USB networking not working properly
 
Hmm... I found a workaround, based on an idea from this thread:
http://talk.maemo.org/showthread.php?p=395452

The advice there is to connect to some kind of connection and then bring up the USB connection. What this does is to affect the route order. I have an automatic version of this workaround that simply removes the unwanted route.

In my case, there's a WLAN connection I can connect to but it's not reliable for actual use. The script also works with a 3G/EDGE connection.

I created /etc/network/if-up.d/99_fix_routes which will run every time a new interface comes up.

Code:

#!/bin/sh

interface="$2"

if [ "$interface" = "usb0" ]; then
    route delete default wlan0
    route delete default gprs0
else
    if ping -c 1 192.168.2.14 >/dev/null 2>&1; then
        route delete default wlan0
        route delete default gprs0
    fi
fi

exit 0

If the USB interface comes up, it removes the default route through the wlan0/gprs0 interfaces (ie. disables traffic through WLAN/EDGE/3G). If some other connection comes up, it pings the USB host and if it's there, it deletes the default route through wlan0/gprs0.

I don't know why GPRS, EDGE and 3G all use the gprs0 device...

This seems to work fine for me but it is still a workaround. What if there was no phone network or wifi point to connect to but you had a computer using some satelite connection setup for USB networking? What I'm saying is that a proper fix would be better than this workaround.

ax31 2009-12-11 04:48

Re: N900 USB networking not working properly
 
Hi
I've tried similar thing before, but with usb interface up first then ones connected to some wlan, I've deleted the second default entry from the routing table. That seemd to work but I couldn't load any pages (except for some cached bits), I was getting weird "Reload" html gibberish, which eventually crashed my browser.

Anyway I'm going to try your way now )

Graham Cobb 2009-12-11 19:18

Re: N900 USB networking not working properly
 
a1291762, what would be great is if you would create an installable package to put in Extras!

You could include your if-up.d script (although I might recommend changing the name to make it clear it came from your package) plus an icon which an ordinary user could use to run a script to do the ifup usb0. A PDF or HTML file with instructions on how to set up the other end as well would really complete the package!

Graham

a1291762 2009-12-13 22:59

Re: N900 USB networking not working properly
 
An installable package sounds like a good idea. I'll give it a go.

ax31 2010-01-11 03:03

Re: N900 USB networking not working properly
 
Just to add, the easiest way to get WiFi connection for it is to create a new WiFi connection through Settings > Internet Connections > Connections and New Name it then click next, set network mode as Ad hoc and Security method as None
Click Next and then on Advanced
There set an Ip Address (uncheck Auto -retrive) to something like 192.168.2.16/24 and default gateway to 196.168.2.14
Might need to set DNS there too
Save it.
It might be good idea to reduce signal power to 10 instead of default 100

Unfortunately you then still need to delete the wlan0 or gprs default route (.

jjx 2010-01-11 03:12

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by ax31 (Post 463247)
Unfortunately you then still need to delete the wlan0 or gprs default route (.

Wouldn't it be enough to give the usb route higher priority with the metric option, or an entry in the policy routing table?

ax31 2010-01-11 04:09

Re: N900 USB networking not working properly
 
I tried that, when you connect to WiFi it automatically creates its routes with metric of 0, when I try to override it within the /etc/interfaces it didn't work, maybe my fault. But certainly changing metric of wlan/gprs to something higher helps ) Thanks.

trotor 2010-01-11 04:18

Re: N900 USB networking not working properly
 
Did you try Mad Developer? IT has some USB settings through gui.

ax31 2010-01-15 04:35

Re: N900 USB networking not working properly
 
After second upgrade USB networking became more difficult since wlan rewrites the route occasionally (
If you use an ad-hoc wifi, it seems to work fine though

gviterbo 2010-01-18 13:01

Re: N900 USB networking not working properly
 
i'm having the same problem as well. I need to transfer something to the filesystem through USB but the instructions I found at http://wiki.maemo.org/N900_USB_Networking do not seem to work.

if enter 'ifdown usb0', it gives me an error - /usr/lib/avahi/avahi-daemon-check-dns.sh: line 143: diff: not found.

total newbie here and I would appreciate if anyone here can help me out. thanks a lot!

by the way, I'm trying to access the filesystem through Winscp.

soeiro 2010-01-18 13:27

Re: N900 USB networking not working properly
 
I've filed a bug on the issue of Connection Manager not recognizing USB networking and the need of extra hacks.

Please vote here, so that we can have proper USB network support:

https://bugs.maemo.org/show_bug.cgi?id=8207

gviterbo 2010-01-18 13:33

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by soeiro (Post 479874)
I've filed a bug on the issue of Connection Manager not recognizing USB networking and the need of extra hacks.

Please vote here, so that we can have proper USB network support:

https://bugs.maemo.org/show_bug.cgi?id=8207

I'm on it. I'll vote for this one. They have to make things way way easier for us to expand N900's open-source horizon. :)

F2thaK 2010-01-20 03:11

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by trotor (Post 463310)
Did you try Mad Developer? IT has some USB settings through gui.


found this the other day couldnt get it to work for me tho


followed these poor instructions and have no idea how to connect to phones system files thru usb

:confused:

http://wiki.maemo.org/N900_USB_networking


EDIT:
can connect but it wont accept password...

using mad developer and maemo pc connectivity pack on n900
and winscp on windows xp pc

also i have wifi but phone is plugged into usb

archebyte 2010-02-03 09:13

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by f2thak (Post 483461)
can connect but it wont accept password...

Are you connecting as 'user' or 'root'? If using 'root', you must use the same password you chose when installing SSH on the N900.

nokix 2010-02-22 03:41

Re: N900 USB networking not working properly
 
this is me trying to get usb networking to work between N900 and XP http://talk.maemo.org/showpost.php?p=540514&postcount=9.

nokix 2010-02-25 07:32

Re: N900 USB networking not working properly
 
finally got it working http://talk.maemo.org/showpost.php?p...8&postcount=14

eitama 2010-03-10 08:19

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by a1291762 (Post 422081)
Hmm... I found a workaround, based on an idea from this thread:
http://talk.maemo.org/showthread.php?p=395452

The advice there is to connect to some kind of connection and then bring up the USB connection. What this does is to affect the route order. I have an automatic version of this workaround that simply removes the unwanted route.

In my case, there's a WLAN connection I can connect to but it's not reliable for actual use. The script also works with a 3G/EDGE connection.

I created /etc/network/if-up.d/99_fix_routes which will run every time a new interface comes up.

Code:

#!/bin/sh

interface="$2"

if [ "$interface" = "usb0" ]; then
    route delete default wlan0
    route delete default gprs0
else
    if ping -c 1 192.168.2.14 >/dev/null 2>&1; then
        route delete default wlan0
        route delete default gprs0
    fi
fi

exit 0

If the USB interface comes up, it removes the default route through the wlan0/gprs0 interfaces (ie. disables traffic through WLAN/EDGE/3G). If some other connection comes up, it pings the USB host and if it's there, it deletes the default route through wlan0/gprs0.

I don't know why GPRS, EDGE and 3G all use the gprs0 device...

This seems to work fine for me but it is still a workaround. What if there was no phone network or wifi point to connect to but you had a computer using some satelite connection setup for USB networking? What I'm saying is that a proper fix would be better than this workaround.

Hi,

Should this line give me the argument you are trying to insert into "interface" and throw it into a file if I put it inside the script?

"echo $2 > /etc/network/if-up.d/temp"

cause it gives me an empty temp file, something is not working very well with the script and I am trying to figure out what.

nokix 2010-03-11 02:43

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by eitama (Post 562183)
Hi,

Should this line give me the argument you are trying to insert into "interface" and throw it into a file if I put it inside the script?

"echo $2 > /etc/network/if-up.d/temp"

cause it gives me an empty temp file, something is not working very well with the script and I am trying to figure out what.

you might like to have a look at the way i do it in http://talk.maemo.org/showthread.php?t=39738 i now have it working everyday in my office where there's no wifi.

pang 2010-12-24 07:06

Re: N900 USB networking not working properly
 
Anyone having any luck for ubuntu 10.04?

archebyte 2011-01-02 15:37

Re: N900 USB networking not working properly
 
Quote:

Originally Posted by pang (Post 903303)
Anyone having any luck for ubuntu 10.04?

USB Networking works flawlessly in 10.04. Now, the USB network interface comes up automatically when I plug in the N900.

I basically followed the instructions on the wiki. Here's my setup.

Ubuntu:

USB network-interface config section in /etc/network/interfaces
Code:

auto n900
iface n900 inet static
      address 192.168.2.14
      netmask 255.255.255.0
      broadcast 192.168.2.255
      up echo 1 > /proc/sys/net/ipv4/ip_forward
      up iptables -P FORWARD ACCEPT
      up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.2.0/24
      down echo 0 > /proc/sys/net/ipv4/ip_forward
      down iptables -t nat -F POSTROUTING

New file to bring up the interface when USB cable is connected and PC-Suite Mode is selected: /etc/udev/rules.d/99-nokia-n900.rules
Code:

SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_ether", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900"
SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_phonet", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900pn"

That's pretty much it. There is no config required on the N900 side.

This is how I get connected.
- Connect USB cable
- Select PC Suite Mode on the N900
- Open Xterm and execute 'ifup usb0' as root
- Start SSH if not running.
- SSH to the N900 from Ubuntu using 'ssh root@n900'

check the connection using ifconfig:
Code:

archebyte@archebyte:/etc/udev/rules.d$ ifconfig n900
n900      Link encap:Ethernet  HWaddr 66:ac:e5:48:13:9e 
          inet addr:192.168.2.14  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::64ac:e5ff:fe48:139e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2025 (2.0 KB)  TX bytes:367 (367.0 B)



All times are GMT. The time now is 06:42.

vBulletin® Version 3.8.8