Re: connect to internet via android phone as usb-modem

2011-04-14 Thread Dan Williams
On Thu, 2011-04-14 at 19:36 +0200, Torsten Spindler wrote:
> I've reverted the udev usage and test now for 'easytether' when checking
> for the driver and assign driver to 'easytether' if so. I've diff'ed vs
> latest git, but tested vs 0.8.4 rc1 and it works fine for me.

Pushed to 0.8 and 0.9, thanks!
Dan


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-04-14 Thread Torsten Spindler
I've reverted the udev usage and test now for 'easytether' when checking
for the driver and assign driver to 'easytether' if so. I've diff'ed vs
latest git, but tested vs 0.8.4 rc1 and it works fine for me.

Torsten

diff --git a/src/nm-udev-manager.c b/src/nm-udev-manager.c
index 853c4fe..f20fe78 100644
--- a/src/nm-udev-manager.c
+++ b/src/nm-udev-manager.c
@@ -385,8 +385,12 @@ device_creator (NMUdevManager *manager,
 	}
 
 	if (!driver) {
-		nm_log_warn (LOGD_HW, "%s: couldn't determine device driver; ignoring...", path);
-		goto out;
+if (g_str_has_prefix (ifname), "easytether") {
+driver = "easytether";
+} else {
+		nm_log_warn (LOGD_HW, "%s: couldn't determine device driver; ignoring...", path);
+		goto out;
+}
 	}
 
 	ifindex = g_udev_device_get_sysfs_attr_as_int (udev_device, "ifindex");
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-18 Thread Torsten Spindler
Hello,

I've changed the hack to now check for a udev environment variable
'NM_PSEUDODRIVER'. If set, the lack of a driver is ignored.
The /etc/udev/rules.d/easytether.rules declares this if an easytether0
device is detected.

If need be I can revert it to check for 'easytether' in the code, but I
think the udev rule based approach is better.

Bye,
Torsten



diff -ruN NetworkManager/src/nm-udev-manager.c NetworkManager-easytether/src/nm-udev-manager.c
--- NetworkManager/src/nm-udev-manager.c	2011-03-10 23:38:01.298038845 +0100
+++ NetworkManager-easytether/src/nm-udev-manager.c	2011-03-18 19:27:06.893019906 +0100
@@ -385,8 +385,12 @@
 	}
 
 	if (!driver) {
-		nm_log_warn (LOGD_HW, "%s: couldn't determine device driver; ignoring...", path);
-		goto out;
+		if (g_udev_device_has_property (udev_device, "NM_PSEUDODRIVER"))
+			driver = g_udev_device_get_property(udev_device, "NM_PSEUDODRIVER");
+		else {
+			nm_log_warn (LOGD_HW, "%s: couldn't determine device driver; ignoring...", path);
+			goto out;
+		}
 	}
 
 	ifindex = g_udev_device_get_sysfs_attr_as_int (udev_device, "ifindex");
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", 
ATTR{idProduct}=="41da", RUN+="/usr/local/bin/easytether"
ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="easytether0", 
ENV{NM_PSEUDODRIVER}="easytether"
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-17 Thread Sergio Monteiro Basto
On Wed, 2011-03-16 at 23:46 -0500, Robby Workman wrote: 
> On Wed, 16 Mar 2011 22:53:34 -0500
> Robby Workman  wrote:
> 
> > For whatever reason, /usr/local/bin/easytether is not getting 
> > started, so I still have to run that manually.  I've edited 
> > the sample udev rule with correct attributes for my device,
> > so I don't know what's going on.  No big deal - I'll mess with
> > that later...
> 
> 
> Well, I had to invoke a wrapper script:
> 
>   root@liberty:~# cat /etc/udev/rules.d/99-easytether.rules 
>   ACTION=="add", \
> SUBSYSTEM=="usb", \
> ATTR{idVendor}=="22b8", \
> ATTR{idProduct}=="2d66", \
> RUN+="/usr/local/bin/MB300 &", \
> ENV{REMOVE_CMD}="/bin/killall easytether 2>/dev/null"
> 
>   root@liberty:~# cat /usr/local/bin/MB300 
>   #!/bin/sh
>   /usr/local/bin/easytether connect &
>  
> The REMOVE_CMD probably isn't necessary, but I left it there anyway :)


easytether works on Fedora 14 with my U8230 , I will try yours patch
(maybe if I had time ) 

Thanks for all replies,
-- 
Sérgio M. B.


smime.p7s
Description: S/MIME cryptographic signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-17 Thread Dan Williams
On Wed, 2011-03-16 at 23:16 +0100, Torsten Spindler wrote:
> On Wed, 2011-03-16 at 15:50 -0500, Dan Williams wrote:
> ...
> > That said, the best way to go about this is likely to use udev scripts
> > to initially create the easytether0 interface, and then we could add
> > some custom code to NM to recognize the easytether0 interface as a
> > normal ethernet device and run DHCP on it.  That wouldn't be *too* hard,
> > probably < 30 lines of code.  It would involve using g_str_has_prefix()
> > looking for easytether in the nm-udev-manager.c code, and if so,
> > bypassing some of the udev /sysfs hierarchy checks that determine
> > hardware relationships and device attributes like driver and
> > description.  That's not something we should be doing for most "virtual"
> > network interfaces, but it's probably OK in the case of easytether.
> 
> Thanks for the advice where to patch network manager. Attached is a very
> first version, plus a basic udev rule for a Motorola Milestone and
> connect script. It works fine on my Ubuntu 10.04 machine right now,
> though it could use some polishing.

Two suggestions for the patch:

1) Kill the first hunk, lets just set a driver name anyway

2) In the second hunk, instead or printing a warning, lets do something
like this:

if (!driver) {
   if (g_str_has_prefix (ifname, "easytether"))
  driver = "easytether";
   else {
  nm_log_warn (LOGD_HW, "%s: couldn't determine device driver; 
ignoring...", path);
  goto out;
   }
}

That makes the hack more contained and gets rid of some of the
extraneous logging.  If you rework the patch and it works fine for you,
I'll merge it.  Thanks!

Dan


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-17 Thread Dan Williams
On Thu, 2011-03-17 at 07:52 +, Sergio Monteiro Basto wrote:
> On Thu, 2011-03-17 at 07:49 +, Sergio Monteiro Basto wrote: 
> > On Wed, 2011-03-16 at 14:46 -0400, Mathieu Trudel-Lapierre wrote:
> > > 
> > > IIRC, this works starting with Android 2.0 (depending on the carriers
> > > though), but I may be wrong. 
> > 
> > I got 2.1 , and don't have "tether option" for network , but I saw that
> > got the option on 2.2. 
> 
> Better saying, I think that begins "Just" on 2.2.  

You can buy various apps that add the functionality, usually in
combination with having to enable "Developer"/debug mode on the phone.
I don't think that requires a full jailbreak of the device though.  One
such app is "easytether".  Early versions of Android did not include
things like the required kernel modules for hotspot mode (ie AP mode
firmware, driver capability, or even the kernel iptables NAT modules)
and thus you have to resort to doing tunnels with apps like easytether
or openvpn.

Dan


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-17 Thread Sergio Monteiro Basto
On Thu, 2011-03-17 at 07:49 +, Sergio Monteiro Basto wrote: 
> On Wed, 2011-03-16 at 14:46 -0400, Mathieu Trudel-Lapierre wrote:
> > 
> > IIRC, this works starting with Android 2.0 (depending on the carriers
> > though), but I may be wrong. 
> 
> I got 2.1 , and don't have "tether option" for network , but I saw that
> got the option on 2.2. 

Better saying, I think that begins "Just" on 2.2.  

-- 
Sérgio M. B.


smime.p7s
Description: S/MIME cryptographic signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-17 Thread Sergio Monteiro Basto
On Wed, 2011-03-16 at 14:46 -0400, Mathieu Trudel-Lapierre wrote:
> 
> IIRC, this works starting with Android 2.0 (depending on the carriers
> though), but I may be wrong. 

I got 2.1 , and don't have "tether option" for network , but I saw that
got the option on 2.2. 

Thanks,
-- 
Sérgio M. B.


smime.p7s
Description: S/MIME cryptographic signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-16 Thread Robby Workman
On Wed, 16 Mar 2011 22:53:34 -0500
Robby Workman  wrote:

> For whatever reason, /usr/local/bin/easytether is not getting 
> started, so I still have to run that manually.  I've edited 
> the sample udev rule with correct attributes for my device,
> so I don't know what's going on.  No big deal - I'll mess with
> that later...


Well, I had to invoke a wrapper script:

  root@liberty:~# cat /etc/udev/rules.d/99-easytether.rules 
  ACTION=="add", \
SUBSYSTEM=="usb", \
ATTR{idVendor}=="22b8", \
ATTR{idProduct}=="2d66", \
RUN+="/usr/local/bin/MB300 &", \
ENV{REMOVE_CMD}="/bin/killall easytether 2>/dev/null"

  root@liberty:~# cat /usr/local/bin/MB300 
  #!/bin/sh
  /usr/local/bin/easytether connect &
 
The REMOVE_CMD probably isn't necessary, but I left it there anyway :)

-RW 
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-16 Thread Robby Workman
On Wed, 16 Mar 2011 23:16:43 +0100
Torsten Spindler  wrote:

> On Wed, 2011-03-16 at 15:50 -0500, Dan Williams wrote:
> ...
> > That said, the best way to go about this is likely to use udev
> > scripts to initially create the easytether0 interface, and then we
> > could add some custom code to NM to recognize the easytether0
> > interface as a normal ethernet device and run DHCP on it.  That
> > wouldn't be *too* hard, probably < 30 lines of code.  It would
> > involve using g_str_has_prefix() looking for easytether in the
> > nm-udev-manager.c code, and if so, bypassing some of the
> > udev /sysfs hierarchy checks that determine hardware relationships
> > and device attributes like driver and description.  That's not
> > something we should be doing for most "virtual" network interfaces,
> > but it's probably OK in the case of easytether.
> 
> Thanks for the advice where to patch network manager. Attached is a
> very first version, plus a basic udev rule for a Motorola Milestone
> and connect script. It works fine on my Ubuntu 10.04 machine right
> now, though it could use some polishing.


Minor typo in "ignorning device driver not found"  :)

Here's what shows in syslog:
   /sys/devices/virtual/net/easytether0: couldn't determine device 
driver; ignoring...
   easytether0: is an easytether device, ignorning device driver not found
   Ignoring driver = NULL for easytether
Perhaps have the code that spawns the first warning not do that if it's an 
easytether device..

Anyway, the NetworkManager side of this works fine - thanks!
For whatever reason, /usr/local/bin/easytether is not getting 
started, so I still have to run that manually.  I've edited 
the sample udev rule with correct attributes for my device,
so I don't know what's going on.  No big deal - I'll mess with
that later...

As an aside, it would be nice if the mobile-stream folks (authors
of easytether) would address the missing sysfs bits, and perhaps 
make the easytether client daemonize properly -- currently it grabs
the console regardless of whether it's backgrounded or not.

I mailed them quite some time ago asking for an ARM client, and
they indicated that the plan was to eventually open-source the
linux client.  Perhaps some encouragement from here will help :-)

-RW
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-16 Thread Torsten Spindler
On Wed, 2011-03-16 at 15:50 -0500, Dan Williams wrote:
...
> That said, the best way to go about this is likely to use udev scripts
> to initially create the easytether0 interface, and then we could add
> some custom code to NM to recognize the easytether0 interface as a
> normal ethernet device and run DHCP on it.  That wouldn't be *too* hard,
> probably < 30 lines of code.  It would involve using g_str_has_prefix()
> looking for easytether in the nm-udev-manager.c code, and if so,
> bypassing some of the udev /sysfs hierarchy checks that determine
> hardware relationships and device attributes like driver and
> description.  That's not something we should be doing for most "virtual"
> network interfaces, but it's probably OK in the case of easytether.

Thanks for the advice where to patch network manager. Attached is a very
first version, plus a basic udev rule for a Motorola Milestone and
connect script. It works fine on my Ubuntu 10.04 machine right now,
though it could use some polishing.

Torsten

diff -ruN NetworkManager/src/nm-device-ethernet.c NetworkManager-easytether/src/nm-device-ethernet.c
--- NetworkManager/src/nm-device-ethernet.c	2011-03-16 14:25:18.834800697 +0100
+++ NetworkManager-easytether/src/nm-device-ethernet.c	2011-03-16 22:19:58.388510568 +0100
@@ -567,7 +567,10 @@
 {
 	g_return_val_if_fail (udi != NULL, NULL);
 	g_return_val_if_fail (iface != NULL, NULL);
-	g_return_val_if_fail (driver != NULL, NULL);
+	if (strcmp("easytether0", iface))
+		g_return_val_if_fail (driver != NULL, NULL);
+	else
+		nm_log_warn (LOGD_HW, "Ignoring driver = NULL for easytether");
 
 	return (NMDevice *) g_object_new (NM_TYPE_DEVICE_ETHERNET,
 	  NM_DEVICE_INTERFACE_UDI, udi,
diff -ruN NetworkManager/src/nm-udev-manager.c NetworkManager-easytether/src/nm-udev-manager.c
--- NetworkManager/src/nm-udev-manager.c	2011-03-10 23:38:01.298038845 +0100
+++ NetworkManager-easytether/src/nm-udev-manager.c	2011-03-16 22:06:32.976528041 +0100
@@ -386,7 +386,10 @@
 
 	if (!driver) {
 		nm_log_warn (LOGD_HW, "%s: couldn't determine device driver; ignoring...", path);
-		goto out;
+		if (!strcmp("easytether0", ifname))
+			nm_log_warn (LOGD_HW, "%s: is an easytether device, ignorning device driver not found", ifname)
+else
+			goto out;
 	}
 
 	ifindex = g_udev_device_get_sysfs_attr_as_int (udev_device, "ifindex");
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", 
ATTR{idProduct}=="41da", RUN+="/usr/local/bin/easytether"


easytether
Description: application/shellscript
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-16 Thread Dan Williams
On Wed, 2011-03-16 at 14:46 -0400, Mathieu Trudel-Lapierre wrote:
> On Tue, Mar 15, 2011 at 3:08 PM, Sergio Monteiro Basto
>  wrote:
> > Hi, I found this page :
> > http://ubuntuguide.net/ubuntu-connect-to-internet-via-android-phone-as-usb-modem
> >
> > Have we something better ou easier with NewtworkManager , to do the same
> > functions ? : "connect to internet via android phone as usb-modem"
> >
> 
> If the version of Android you're running is recent enough, it should
> be as simple as going in settings and selecting Wireless and Networks,
> then Connection Sharing, and enabling connection sharing Via USB.
> 
> IIRC, this works starting with Android 2.0 (depending on the carriers
> though), but I may be wrong.

Mobile hotspot is clearly the better solution here, but for older
versions of android, if for some reason you can't run an XDA/Cyanogen
build, and you're using easytether, there may be some hope.  The problem
with easytether is that it's a closed-source blob on Linux and thus
there's no way to improve the interaction between it and NetworkManager
in the future.  We're stuck with whatever easytether decides it wants to
do today, and we have no recourse to improve it.

That said, the best way to go about this is likely to use udev scripts
to initially create the easytether0 interface, and then we could add
some custom code to NM to recognize the easytether0 interface as a
normal ethernet device and run DHCP on it.  That wouldn't be *too* hard,
probably < 30 lines of code.  It would involve using g_str_has_prefix()
looking for easytether in the nm-udev-manager.c code, and if so,
bypassing some of the udev /sysfs hierarchy checks that determine
hardware relationships and device attributes like driver and
description.  That's not something we should be doing for most "virtual"
network interfaces, but it's probably OK in the case of easytether.

Dan


___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: connect to internet via android phone as usb-modem

2011-03-16 Thread Mathieu Trudel-Lapierre
On Tue, Mar 15, 2011 at 3:08 PM, Sergio Monteiro Basto
 wrote:
> Hi, I found this page :
> http://ubuntuguide.net/ubuntu-connect-to-internet-via-android-phone-as-usb-modem
>
> Have we something better ou easier with NewtworkManager , to do the same
> functions ? : "connect to internet via android phone as usb-modem"
>

If the version of Android you're running is recent enough, it should
be as simple as going in settings and selecting Wireless and Networks,
then Connection Sharing, and enabling connection sharing Via USB.

IIRC, this works starting with Android 2.0 (depending on the carriers
though), but I may be wrong.

Mathieu Trudel-Lapierre 
Freenode: cyphermox, Jabber: mathieu...@gmail.com
4096R/EE018C93 1967 8F7D 03A1 8F38 732E  FF82 C126 33E1 EE01 8C93
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list