mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 13:08:10 +02:00
2007-12-06 Tambet Ingo <tambet@gmail.com>
* src/nm-umts-device.c (real_act_stage1_prepare): Flash the
* modem (drop DTR)
before doing anything else.
(init_modem): Move modem initialization here.
* src/nm-serial-device.c (ppp_state_changed): React on pppd
* state changes.
(nm_serial_device_flash): Implement.
* src/ppp-manager/nm-ppp-manager.c (name_owner_changed): Fix the
* typoes: the state
changes signal is "StateChanged" and not "Status".
(ppp_exit_code, ppp_status_changed): Remove the debug output,
it's working fine now.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3146 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
a9a58b28c7
commit
f2f36ffa7b
6 changed files with 88 additions and 39 deletions
13
ChangeLog
13
ChangeLog
|
|
@ -1,3 +1,16 @@
|
||||||
|
2007-12-06 Tambet Ingo <tambet@gmail.com>
|
||||||
|
|
||||||
|
* src/nm-umts-device.c (real_act_stage1_prepare): Flash the modem (drop DTR)
|
||||||
|
before doing anything else.
|
||||||
|
(init_modem): Move modem initialization here.
|
||||||
|
|
||||||
|
* src/nm-serial-device.c (ppp_state_changed): React on pppd state changes.
|
||||||
|
(nm_serial_device_flash): Implement.
|
||||||
|
|
||||||
|
* src/ppp-manager/nm-ppp-manager.c (name_owner_changed): Fix the typoes: the state
|
||||||
|
changes signal is "StateChanged" and not "Status".
|
||||||
|
(ppp_exit_code, ppp_status_changed): Remove the debug output, it's working fine now.
|
||||||
|
|
||||||
2007-12-06 Dan Williams <dcbw@redhat.com>
|
2007-12-06 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/supplicant-manager/nm-supplicant-config.c
|
* src/supplicant-manager/nm-supplicant-config.c
|
||||||
|
|
|
||||||
|
|
@ -697,67 +697,93 @@ nm_serial_device_wait_quiet (NMSerialDevice *device,
|
||||||
wait_quiet_info_destroy);
|
wait_quiet_info_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMSerialDevice *device;
|
NMSerialDevice *device;
|
||||||
int current_speed;
|
speed_t current_speed;
|
||||||
NMSerialFlashFn callback;
|
NMSerialFlashFn callback;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
} FlashInfo;
|
} FlashInfo;
|
||||||
|
|
||||||
static gboolean
|
static speed_t
|
||||||
flash_done (gpointer user_data)
|
get_speed (NMSerialDevice *device)
|
||||||
{
|
{
|
||||||
FlashInfo *info = (FlashInfo *) user_data;
|
struct termios options;
|
||||||
|
|
||||||
/* FIXME: Restore the speed */
|
tcgetattr (NM_SERIAL_DEVICE_GET_PRIVATE (device)->fd, &options);
|
||||||
info->current_speed;
|
|
||||||
|
|
||||||
|
return cfgetospeed (&options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_speed (NMSerialDevice *device, speed_t speed)
|
||||||
|
{
|
||||||
|
struct termios options;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = NM_SERIAL_DEVICE_GET_PRIVATE (device)->fd;
|
||||||
|
tcgetattr (fd, &options);
|
||||||
|
|
||||||
|
cfsetispeed (&options, speed);
|
||||||
|
cfsetospeed (&options, speed);
|
||||||
|
|
||||||
|
options.c_cflag |= (CLOCAL | CREAD);
|
||||||
|
tcsetattr (fd, TCSANOW, &options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
flash_done (gpointer data)
|
||||||
|
{
|
||||||
|
FlashInfo *info = (FlashInfo *) data;
|
||||||
|
|
||||||
|
set_speed (info->device, info->current_speed);
|
||||||
info->callback (info->device, info->user_data);
|
info->callback (info->device, info->user_data);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
guint
|
||||||
nm_serial_device_flash (NMSerialDevice *device,
|
nm_serial_device_flash (NMSerialDevice *device,
|
||||||
guint32 flash_time,
|
guint32 flash_time,
|
||||||
NMSerialFlashFn callback,
|
NMSerialFlashFn callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
struct termio stbuf;
|
|
||||||
int speed;
|
|
||||||
FlashInfo *info;
|
FlashInfo *info;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_SERIAL_DEVICE (device));
|
g_return_val_if_fail (NM_IS_SERIAL_DEVICE (device), 0);
|
||||||
g_return_if_fail (callback != NULL);
|
g_return_val_if_fail (callback != NULL, 0);
|
||||||
|
|
||||||
fd = NM_SERIAL_DEVICE_GET_PRIVATE (device)->fd;
|
|
||||||
|
|
||||||
ioctl (fd, TCGETA, &stbuf);
|
|
||||||
speed = stbuf.c_cflags & CBAUD;
|
|
||||||
|
|
||||||
/* FIXME: Set speed to 0 */
|
|
||||||
|
|
||||||
info = g_new (FlashInfo, 1);
|
info = g_new (FlashInfo, 1);
|
||||||
info->device = device;
|
info->device = device;
|
||||||
info->current_speed = speed;
|
info->current_speed = get_speed (device);
|
||||||
info->callback = callback;
|
info->callback = callback;
|
||||||
info->user_data = user_data;
|
info->user_data = user_data;
|
||||||
|
|
||||||
g_timeout_add_full (G_PRIORITY_DEFAULT,
|
set_speed (device, B0);
|
||||||
flash_time,
|
|
||||||
flash_done,
|
|
||||||
info,
|
|
||||||
g_free);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
return g_timeout_add_full (G_PRIORITY_DEFAULT,
|
||||||
|
flash_time,
|
||||||
|
flash_done,
|
||||||
|
info,
|
||||||
|
g_free);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ppp_state_changed (NMPPPManager *ppp_manager, NMPPPStatus status, gpointer user_data)
|
ppp_state_changed (NMPPPManager *ppp_manager, NMPPPStatus status, gpointer user_data)
|
||||||
{
|
{
|
||||||
nm_debug ("ppp state changed: %d", status);
|
NMDevice *device = NM_DEVICE (user_data);
|
||||||
/* FIXME */
|
|
||||||
|
switch (status) {
|
||||||
|
case NM_PPP_STATUS_NETWORK:
|
||||||
|
nm_device_state_changed (device, NM_DEVICE_STATE_IP_CONFIG);
|
||||||
|
break;
|
||||||
|
case NM_PPP_STATUS_DISCONNECT:
|
||||||
|
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ void nm_serial_device_wait_quiet (NMSerialDevice *device,
|
||||||
NMSerialWaitQuietFn callback,
|
NMSerialWaitQuietFn callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void nm_serial_device_flash (NMSerialDevice *device,
|
guint nm_serial_device_flash (NMSerialDevice *device,
|
||||||
guint32 flash_time,
|
guint32 flash_time,
|
||||||
NMSerialFlashFn callback,
|
NMSerialFlashFn callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
|
||||||
|
|
@ -421,20 +421,33 @@ init_done (NMSerialDevice *device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_modem (NMSerialDevice *device, gpointer user_data)
|
||||||
|
{
|
||||||
|
guint id;
|
||||||
|
char *responses[] = { "OK", "ERR", NULL };
|
||||||
|
|
||||||
|
nm_serial_device_send_command_string (device, "ATZ E0");
|
||||||
|
id = nm_serial_device_wait_for_reply (device, 10, responses, init_done, NULL);
|
||||||
|
|
||||||
|
if (id)
|
||||||
|
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
|
||||||
|
else
|
||||||
|
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
real_act_stage1_prepare (NMDevice *device)
|
real_act_stage1_prepare (NMDevice *device)
|
||||||
{
|
{
|
||||||
NMUmtsDevicePrivate *priv = NM_UMTS_DEVICE_GET_PRIVATE (device);
|
NMUmtsDevicePrivate *priv = NM_UMTS_DEVICE_GET_PRIVATE (device);
|
||||||
NMSerialDevice *serial_device = NM_SERIAL_DEVICE (device);
|
NMSerialDevice *serial_device = NM_SERIAL_DEVICE (device);
|
||||||
char *responses[] = { "OK", "ERR", NULL };
|
|
||||||
|
|
||||||
priv->need_secret = NM_UMTS_SECRET_NONE;
|
priv->need_secret = NM_UMTS_SECRET_NONE;
|
||||||
|
|
||||||
if (!nm_serial_device_open (NM_SERIAL_DEVICE (device)))
|
if (!nm_serial_device_open (serial_device))
|
||||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
|
|
||||||
nm_serial_device_send_command_string (serial_device, "ATZ E0");
|
priv->pending_id = nm_serial_device_flash (serial_device, 100, init_modem, NULL);
|
||||||
priv->pending_id = nm_serial_device_wait_for_reply (serial_device, 10, responses, init_done, NULL);
|
|
||||||
|
|
||||||
return priv->pending_id ? NM_ACT_STAGE_RETURN_POSTPONE : NM_ACT_STAGE_RETURN_FAILURE;
|
return priv->pending_id ? NM_ACT_STAGE_RETURN_POSTPONE : NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -381,8 +381,8 @@ name_owner_changed (NMDBusManager *dbus_manager,
|
||||||
NM_DBUS_PATH_PPP,
|
NM_DBUS_PATH_PPP,
|
||||||
NM_DBUS_INTERFACE_PPP);
|
NM_DBUS_INTERFACE_PPP);
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "Status", G_TYPE_UINT, G_TYPE_INVALID);
|
dbus_g_proxy_add_signal (priv->proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
|
||||||
dbus_g_proxy_connect_signal (priv->proxy, "Status",
|
dbus_g_proxy_connect_signal (priv->proxy, "StateChanged",
|
||||||
G_CALLBACK (ppp_status_changed),
|
G_CALLBACK (ppp_status_changed),
|
||||||
manager, NULL);
|
manager, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,6 @@ nm_phasechange (void *data, int arg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_message ("pppd reported new phase: %s", ppp_phase);
|
|
||||||
|
|
||||||
if (ppp_status != NM_PPP_STATUS_UNKNOWN)
|
if (ppp_status != NM_PPP_STATUS_UNKNOWN)
|
||||||
nm_pppd_plugin_state_changed (plugin, ppp_status);
|
nm_pppd_plugin_state_changed (plugin, ppp_status);
|
||||||
}
|
}
|
||||||
|
|
@ -301,7 +299,6 @@ nm_exit_notify (void *data, int arg)
|
||||||
{
|
{
|
||||||
NMPppdPlugin *plugin = NM_PPPD_PLUGIN (data);
|
NMPppdPlugin *plugin = NM_PPPD_PLUGIN (data);
|
||||||
|
|
||||||
g_message ("exiting");
|
|
||||||
g_object_unref (plugin);
|
g_object_unref (plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue