1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-24 15:12:31 +01:00

Convert strings being prints out by dhclients to utf-8 before trying to log them.

When iwscan displays two entries for a hidden network, only display the one with the essid included.
This commit is contained in:
Dan O'Reilly
2009-06-14 14:25:06 -04:00
parent d2d2bae6d8
commit d07dea2390
2 changed files with 20 additions and 7 deletions

View File

@@ -315,6 +315,13 @@ class ConnectThread(threading.Thread):
self.SetStatus('interface_down')
def run(self):
self.connect_result = "Failed"
try:
self._connect()
finally:
self.is_connecting = False
def set_should_die(self, val):
self.lock.acquire()
try:
@@ -794,7 +801,7 @@ class WirelessConnectThread(ConnectThread):
self.wpa_driver = wpa_driver
def run(self):
def _connect(self):
""" The main function of the connection thread.
This function performs the necessary calls to connect to the
@@ -1006,7 +1013,7 @@ class WiredConnectThread(ConnectThread):
after_script, disconnect_script, gdns1, gdns2,
gdns3, gdns_dom, gsearch_dom, liface, debug)
def run(self):
def _connect(self):
""" The main function of the connection thread.
This function performs the necessary calls to connect to the

View File

@@ -431,7 +431,7 @@ class BaseInterface(object):
if line == '': # Empty string means dhclient is done.
dhclient_complete = True
else:
print line.strip('\n')
print misc.to_unicode(line.strip('\n'))
if line.startswith('bound'):
dhclient_success = True
dhclient_complete = True
@@ -458,7 +458,7 @@ class BaseInterface(object):
elif line.strip().lower().startswith('Operation failed.'):
pump_success = False
pump_complete = True
print line
print misc.to_unicode(line)
return self._check_dhcp_result(pump_success)
@@ -482,7 +482,7 @@ class BaseInterface(object):
dhcpcd_complete = True
elif line == '':
dhcpcd_complete = True
print line
print misc.to_unicode(line)
return self._check_dhcp_result(dhcpcd_success)
@@ -1106,15 +1106,21 @@ class BaseWirelessInterface(BaseInterface):
# An array for the access points
access_points = []
access_points = {}
for cell in networks:
# Only use sections where there is an ESSID.
if 'ESSID:' in cell:
# Add this network to the list of networks
entry = self._ParseAccessPoint(cell, ralink_info)
if entry is not None:
access_points.append(entry)
# Normally we only get duplicate bssids with hidden
# networks. If we hit this, we only want the entry
# with the real essid to be in the network list.
if (entry['bssid'] not in access_points
or not entry['hidden']):
access_points[entry['bssid']] = entry
return access_points
return access_points.values()
def _ParseAccessPoint(self, cell, ralink_info):
""" Parse a single cell from the output of iwlist.