diff --git a/Menu/GameShell/10_Settings/Airplane/__init__.py b/Menu/GameShell/10_Settings/Airplane/__init__.py index 14c15ed..c8aaac5 100644 --- a/Menu/GameShell/10_Settings/Airplane/__init__.py +++ b/Menu/GameShell/10_Settings/Airplane/__init__.py @@ -108,6 +108,8 @@ class AirplanePage(Page): self._Scroller.Init() self._Scroller.SetCanvasHWND(self._HWND) + self.OnLoadCb() + def ScrollDown(self): dis = 10 if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0: diff --git a/Menu/GameShell/10_Settings/Bluetooth/__init__.py b/Menu/GameShell/10_Settings/Bluetooth/__init__.py index 207639c..ecd2b41 100644 --- a/Menu/GameShell/10_Settings/Bluetooth/__init__.py +++ b/Menu/GameShell/10_Settings/Bluetooth/__init__.py @@ -393,6 +393,8 @@ class BluetoothPage(Page): _ADAPTER_DEV = "hci0" + _Offline = False + def __init__(self): Page.__init__(self) self._WirelessList = [] @@ -617,10 +619,18 @@ class BluetoothPage(Page): self.GenNetworkList() def OnLoadCb(self): - self.RefreshDevices() + self._Offline = False + if self._Screen._TitleBar._InAirPlaneMode == False: + out = commands.getstatusoutput("hcitool dev | grep hci0 |cut -f3") ## bluetooth maybe dead after airplane mode + if len(out[1]) < 17: + self._Offline = True + print("Bluetooth OnLoadCb ,can not find hci0 alive,try to reboot") + else: + self.RefreshDevices() + self.GenNetworkList() + else: + self._Offline = True - self.GenNetworkList() - def ScrollUp(self): if len(self._WirelessList) == 0: return @@ -648,6 +658,10 @@ class BluetoothPage(Page): def KeyDown(self,event): if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]: + if self._Offline == True: + self.AbortedAndReturnToUpLevel() + return + if self._Adapter != None: try: self._Adapter.StopDiscovery() @@ -679,13 +693,15 @@ class BluetoothPage(Page): self._Screen.SwapAndShow() if event.key == CurKeys["X"]: - - self.Rescan() + if self._Offline == False: + self.Rescan() if event.key == CurKeys["Y"]: if len(self._WirelessList) == 0: return - + if self._Offline == True: + return + self._InfoPage._AList = self._WirelessList[self._PsIndex]._Atts self._InfoPage._Path = self._WirelessList[self._PsIndex]._Path self._Screen.PushPage(self._InfoPage) @@ -693,7 +709,8 @@ class BluetoothPage(Page): self._Screen.SwapAndShow() if event.key == CurKeys["B"]: - self.TryConnect() + if self._Offline == False: + self.TryConnect() def Draw(self): self.ClearCanvas() @@ -743,10 +760,10 @@ class APIOBJ(object): self._Page.Init() bus.add_signal_receiver(self._Page.DbusPropertiesChanged, - dbus_interface = "org.freedesktop.DBus.Properties", - signal_name = "PropertiesChanged", - arg0 = "org.bluez.Device1", - path_keyword = "path") + dbus_interface = "org.freedesktop.DBus.Properties", + signal_name = "PropertiesChanged", + arg0 = "org.bluez.Device1", + path_keyword = "path") def API(self,main_screen): if main_screen !=None: diff --git a/Menu/GameShell/10_Settings/Bluetooth/net_item.py b/Menu/GameShell/10_Settings/Bluetooth/net_item.py index 7fbbef0..c3d173d 100644 --- a/Menu/GameShell/10_Settings/Bluetooth/net_item.py +++ b/Menu/GameShell/10_Settings/Bluetooth/net_item.py @@ -92,6 +92,8 @@ class NetItem(object): print(object["RSSI"]) self._RSSI = int(object["RSSI"]) + mac_addr = mac_addr[:34] + name_label.Init(mac_addr,self._FontObj) self._Labels["mac_addr"] = name_label diff --git a/Menu/GameShell/10_Settings/Wifi/wifi_list.py b/Menu/GameShell/10_Settings/Wifi/wifi_list.py index dbdfe6c..c2d6c09 100644 --- a/Menu/GameShell/10_Settings/Wifi/wifi_list.py +++ b/Menu/GameShell/10_Settings/Wifi/wifi_list.py @@ -296,6 +296,7 @@ class WifiList(Page): _ListFontObj = fonts["notosanscjk15"] _InfoPage = None + _CurBssid = "" def __init__(self): Page.__init__(self) @@ -517,7 +518,14 @@ class WifiList(Page): return True def ConfigWireless(self,password): + netid = self._PsIndex + + for i,v in enumerate(self._WirelessList): + if v._Bssid == self._CurBssid: + netid = i + break + print(netid," ", password) """ self._Wireless.SetWirelessProperty(netid,"dhcphostname","GameShell") @@ -652,6 +660,8 @@ class WifiList(Page): if len(self._WirelessList) == 0: return + self._CurBssid = self._WirelessList[self._PsIndex]._Bssid + wicd_wirelss_encrypt_pwd = self.GetWirelessEncrypt(self._PsIndex) if self._WirelessList[self._PsIndex]._IsActive: self.ShowBox( self._Wireless.GetWirelessIP('') )