Ticket #4459: 4459_098.patch
File 4459_098.patch, 2.9 KB (added by erikos, 10 years ago) |
---|
-
extensions/deviceicon/network.py
diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py index 5475407..246701a 100644
a b class WirelessPalette(Palette): 137 137 self._set_channel(channel) 138 138 139 139 def _set_channel(self, channel): 140 self._channel_label.set_text('%s: %d' % (_('Channel'), channel)) 140 if channel == 0: 141 self._channel_label.set_text('%s: %s' % (_('Channel'), 142 _('Unknown'))) 143 else: 144 self._channel_label.set_text('%s: %d' % (_('Channel'), 145 channel)) 141 146 142 147 def _set_ip_address(self, ip_address): 143 148 if ip_address is not None: -
src/jarabe/model/network.py
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py index 53e170a..34f8bcb 100644
a b def get_error_by_reason(reason): 310 310 311 311 def frequency_to_channel(frequency): 312 312 """Returns the channel matching a given radio channel frequency. If a 313 frequency is not in the dictionary channel 1will be returned.313 frequency is not in the dictionary channel 0 will be returned. 314 314 315 315 Keyword arguments: 316 316 frequency -- The radio channel frequency in MHz. 317 317 318 Return: Channel 318 Return: Channel represented by the frequency or 0 319 319 320 320 """ 321 ftoc = {2412: 1, 2417: 2, 2422: 3, 2427: 4, 322 2432: 5, 2437: 6, 2442: 7, 2447: 8, 323 2452: 9, 2457: 10, 2462: 11, 2467: 12, 324 2472: 13} 325 if frequency not in ftoc: 321 bg_table = {2412: 1, 2417: 2, 2422: 3, 2427: 4, 322 2432: 5, 2437: 6, 2442: 7, 2447: 8, 323 2452: 9, 2457: 10, 2462: 11, 2467: 12, 324 2472: 13, 14: 2484} 325 326 a_table = {5035: 7, 5040: 8, 5045: 9, 5055: 11, 327 5060: 12, 5080: 16, 5170: 34, 328 5180: 36, 5190: 38, 5200: 40, 329 5210: 42, 5220: 44, 5230: 46, 330 5240: 48, 5250: 50, 5260: 52, 331 5280: 56, 5290: 58, 5300: 60, 332 5320: 64, 5500: 100, 5520: 104, 333 5540: 108, 5560: 112, 5580: 116, 334 5600: 120, 5620: 124, 5640: 128, 335 5660: 132, 5680: 136, 5700: 140, 336 5745: 149, 5760: 152, 5765: 153, 337 5785: 157, 5800: 160, 5805: 161, 338 5825: 165, 4915: 183, 4920: 184, 339 4925: 185, 4935: 187, 4945: 188, 340 4960: 192, 4980: 196} 341 342 if frequency not in bg_table and frequency not in a_table: 326 343 logging.warning('The frequency %s can not be mapped to a channel, ' 327 'defaulting to channel 1.', frequency) 328 return 1 329 return ftoc[frequency] 344 'returning 0.', frequency) 345 return 0 346 347 if frequency > 4900: 348 return a_table[frequency] 349 else: 350 return bg_table[frequency] 330 351 331 352 332 353 def is_sugar_adhoc_network(ssid):