mirror of
https://github.com/gryf/wicd.git
synced 2026-01-04 21:04:15 +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:
@@ -315,6 +315,13 @@ class ConnectThread(threading.Thread):
|
|||||||
|
|
||||||
self.SetStatus('interface_down')
|
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):
|
def set_should_die(self, val):
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
@@ -794,7 +801,7 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
self.wpa_driver = wpa_driver
|
self.wpa_driver = wpa_driver
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def _connect(self):
|
||||||
""" The main function of the connection thread.
|
""" The main function of the connection thread.
|
||||||
|
|
||||||
This function performs the necessary calls to connect to the
|
This function performs the necessary calls to connect to the
|
||||||
@@ -1006,7 +1013,7 @@ class WiredConnectThread(ConnectThread):
|
|||||||
after_script, disconnect_script, gdns1, gdns2,
|
after_script, disconnect_script, gdns1, gdns2,
|
||||||
gdns3, gdns_dom, gsearch_dom, liface, debug)
|
gdns3, gdns_dom, gsearch_dom, liface, debug)
|
||||||
|
|
||||||
def run(self):
|
def _connect(self):
|
||||||
""" The main function of the connection thread.
|
""" The main function of the connection thread.
|
||||||
|
|
||||||
This function performs the necessary calls to connect to the
|
This function performs the necessary calls to connect to the
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ class BaseInterface(object):
|
|||||||
if line == '': # Empty string means dhclient is done.
|
if line == '': # Empty string means dhclient is done.
|
||||||
dhclient_complete = True
|
dhclient_complete = True
|
||||||
else:
|
else:
|
||||||
print line.strip('\n')
|
print misc.to_unicode(line.strip('\n'))
|
||||||
if line.startswith('bound'):
|
if line.startswith('bound'):
|
||||||
dhclient_success = True
|
dhclient_success = True
|
||||||
dhclient_complete = True
|
dhclient_complete = True
|
||||||
@@ -458,7 +458,7 @@ class BaseInterface(object):
|
|||||||
elif line.strip().lower().startswith('Operation failed.'):
|
elif line.strip().lower().startswith('Operation failed.'):
|
||||||
pump_success = False
|
pump_success = False
|
||||||
pump_complete = True
|
pump_complete = True
|
||||||
print line
|
print misc.to_unicode(line)
|
||||||
|
|
||||||
return self._check_dhcp_result(pump_success)
|
return self._check_dhcp_result(pump_success)
|
||||||
|
|
||||||
@@ -482,7 +482,7 @@ class BaseInterface(object):
|
|||||||
dhcpcd_complete = True
|
dhcpcd_complete = True
|
||||||
elif line == '':
|
elif line == '':
|
||||||
dhcpcd_complete = True
|
dhcpcd_complete = True
|
||||||
print line
|
print misc.to_unicode(line)
|
||||||
|
|
||||||
return self._check_dhcp_result(dhcpcd_success)
|
return self._check_dhcp_result(dhcpcd_success)
|
||||||
|
|
||||||
@@ -1106,15 +1106,21 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
|
|
||||||
# An array for the access points
|
# An array for the access points
|
||||||
access_points = []
|
access_points = []
|
||||||
|
access_points = {}
|
||||||
for cell in networks:
|
for cell in networks:
|
||||||
# Only use sections where there is an ESSID.
|
# Only use sections where there is an ESSID.
|
||||||
if 'ESSID:' in cell:
|
if 'ESSID:' in cell:
|
||||||
# Add this network to the list of networks
|
# Add this network to the list of networks
|
||||||
entry = self._ParseAccessPoint(cell, ralink_info)
|
entry = self._ParseAccessPoint(cell, ralink_info)
|
||||||
if entry is not None:
|
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):
|
def _ParseAccessPoint(self, cell, ralink_info):
|
||||||
""" Parse a single cell from the output of iwlist.
|
""" Parse a single cell from the output of iwlist.
|
||||||
|
|||||||
Reference in New Issue
Block a user