Re: Auto Connect through NetworkManager

2009-05-14 Thread Dan Williams
On Thu, 2009-05-14 at 09:31 +0800, 代尔欣 wrote:
 Hi sanjeev,
  Change 
 g_signal_emit_by_name (device, state-changed, state, old_state,  0);
   to 
 g_signal_emit_by_name (device, state-changed, state, old_state,
 reason);
  
 in function src/nm-device.c nm_device_state_changed(). This is why you
 always receive reason 0. After change, you should receive the correct
 reason.
 
 Hi Dan,
  If user want to GSM auto connect, but not always want to auto
 connect e.g. user disconnect manually,  The current networkmanager do
 not act like this. 
 Now when click the disconnect , the device will reconnect again.
 This behavior is a little strange I think. 
   It is better if the auto connect occur when system up, network
 not available(e.g. unplug the net plug). But when user disconnect
 manually, do not auto connect.

What I'm afraid of here is user confusion.  You have to remember that
now, after you've clicked disconnect, the device needs to be *manually*
reactivated, even though your connections have a Connect automatically
checkbox.  The behavior is now inconsistent.  Automatic no longer means
automatic.  So now you suspend the laptop and resume later, and you're
not reconnected to anything.  I'm not opposed to this sort of
disconnected device property, but it's a larger job than just an
attribute in NetworkManager.  It also involves figuring out how the UI
should handle it, how users should be alerted that their networks won't
be automatically reconnected.  The user is more apt to blame the
computer or NetworkManager when it doesn't do what they expect, rather
than blame themselves for something they did an hour ago which they've
already forgotten.

Dan

 Thank!
 
 
   
 
 Dan
 
 __
 _
 NetworkManager-list mailing list
 NetworkManager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list
 
 
 2009/5/13 Dan Williams d...@redhat.com
 On Wed, 2009-05-13 at 10:20 +0530, sanjeev sharma wrote:
  Hi All,
 
  Is there any possibility to Disable Auto Connect through
  NetworkManager Code. in my Scenario If Auto Connect  Is
 enabled In
  GSM Profile and User Click on Disconnect button then I
 wanted to Set
  Auto Connect flag disabled so networkManager won't retry
 to Start
  Connection again.
 
 
 That would imply you want to uncheck Connect automatically,
 because
 you don't actually want the connection to be automatically
 activated
 when its available.
 
  I don't want to change Auto Connect manually through
 Connection
  editior because during resume my System has been checking
 mail and its
  will start Connection if only Auto Connect is set.
 
 
 Instead, on resume you want NM to re-activate connections that
 were
 active when the system went to sleep (as long as that
 connection is
 available).  Does that sound right?
 
 Dan
 
 
 ___
 NetworkManager-list mailing list
 NetworkManager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list
 
 

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


Re: Auto Connect through NetworkManager

2009-05-13 Thread 代尔欣
Hi,
I met this problem also. I have a related mail. The subject is:
Question in function nm_device_state_changed()
about this issue. After fix the function
nm_device_state_changed(NMDevice *device, NMDeviceState state,
NMDeviceStateReason reason):

Then we can add below codes to solve this:
src/NetworkManagerPolicy.c
static void device_state_changed (NMDevice *device,
  NMDeviceState new_state,
  NMDeviceState old_state,
  NMDeviceStateReason reason,
  gpointer user_data)
{
...
switch (new_state) {
case NM_DEVICE_STATE_FAILED:

schedule_activate_check (policy, device);
break;
case NM_DEVICE_STATE_ACTIVATED:

break;
case NM_DEVICE_STATE_UNMANAGED:
case NM_DEVICE_STATE_UNAVAILABLE:
case NM_DEVICE_STATE_DISCONNECTED:
update_routing_and_dns (policy, FALSE);
*/* Add this check to avoid auto connect if user disconnect the connection*/
*
   * if(reason != NM_DEVICE_STATE_REASON_USER_REQUESTED)*
schedule_activate_check (policy, device);
break;
default:
break;
}
}

Or another way, in specific device(e.g. GSM):
1.  In device_state_changed() function, set a reason flag when
*NM_DEVICE_STATE_REASON_USER_REQUESTED* reason found.
2.  Reload the *can_activate* function check the reason flag, if it is user
disconnect, return false.

Above just what I thought to resolve this problem. Of course, need Dan give
us the best solution.



2009/5/13 sanjeev sharma sanjeevsharmae...@gmail.com

 Hi All,

 Is there any possibility to Disable Auto Connect through
 NetworkManager Code. in my Scenario If Auto Connect  Is enabled In
 GSM Profile and User Click on Disconnect button then I wanted to Set
 Auto Connect flag disabled so networkManager won't retry to Start
 Connection again.

 I don't want to change Auto Connect manually through Connection
 editior because during resume my System has been checking mail and its
 will start Connection if only Auto Connect is set.

 Through some pointer on it.

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

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


Re: Auto Connect through NetworkManager

2009-05-13 Thread Dan Williams
On Wed, 2009-05-13 at 10:20 +0530, sanjeev sharma wrote:
 Hi All,
 
 Is there any possibility to Disable Auto Connect through
 NetworkManager Code. in my Scenario If Auto Connect  Is enabled In
 GSM Profile and User Click on Disconnect button then I wanted to Set
 Auto Connect flag disabled so networkManager won't retry to Start
 Connection again.

That would imply you want to uncheck Connect automatically, because
you don't actually want the connection to be automatically activated
when its available.

 I don't want to change Auto Connect manually through Connection
 editior because during resume my System has been checking mail and its
 will start Connection if only Auto Connect is set.

Instead, on resume you want NM to re-activate connections that were
active when the system went to sleep (as long as that connection is
available).  Does that sound right?

Dan

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


Re: Auto Connect through NetworkManager

2009-05-13 Thread 代尔欣
Hi sanjeev,
 Change
g_signal_emit_by_name (device, state-changed, state, old_state,  0);
  to
g_signal_emit_by_name (device, state-changed, state, old_state,  reason);

in function src/nm-device.c nm_device_state_changed(). This is why you
always receive reason 0. After change, you should receive the correct
reason.

Hi Dan,
 If user want to GSM auto connect, but not always want to auto connect
e.g. user disconnect manually,  The current networkmanager do not act like
this.
Now when click the disconnect , the device will reconnect again. This
behavior is a little strange I think.
  It is better if the auto connect occur when system up, network not
available(e.g. unplug the net plug). But when user disconnect manually, do
not auto connect.

Thank!




Dan

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


2009/5/13 Dan Williams d...@redhat.com

 On Wed, 2009-05-13 at 10:20 +0530, sanjeev sharma wrote:
  Hi All,
 
  Is there any possibility to Disable Auto Connect through
  NetworkManager Code. in my Scenario If Auto Connect  Is enabled In
  GSM Profile and User Click on Disconnect button then I wanted to Set
  Auto Connect flag disabled so networkManager won't retry to Start
  Connection again.

 That would imply you want to uncheck Connect automatically, because
 you don't actually want the connection to be automatically activated
 when its available.

  I don't want to change Auto Connect manually through Connection
  editior because during resume my System has been checking mail and its
  will start Connection if only Auto Connect is set.

 Instead, on resume you want NM to re-activate connections that were
 active when the system went to sleep (as long as that connection is
 available).  Does that sound right?

 Dan

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

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


Auto Connect through NetworkManager

2009-05-12 Thread sanjeev sharma
Hi All,

Is there any possibility to Disable Auto Connect through
NetworkManager Code. in my Scenario If Auto Connect  Is enabled In
GSM Profile and User Click on Disconnect button then I wanted to Set
Auto Connect flag disabled so networkManager won't retry to Start
Connection again.

I don't want to change Auto Connect manually through Connection
editior because during resume my System has been checking mail and its
will start Connection if only Auto Connect is set.

Through some pointer on it.

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