mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 16:08:52 +01:00
disable power_save at startup
This commit is contained in:
parent
c624d42977
commit
edc07725d2
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,3 +1,15 @@
|
|||||||
test
|
test
|
||||||
main
|
main
|
||||||
*.so
|
*.so
|
||||||
|
retroarch-core-options.cfg
|
||||||
|
*.lpl
|
||||||
|
*.swp
|
||||||
|
.bsv
|
||||||
|
*.pyc
|
||||||
|
sysgo/.powerlevel
|
||||||
|
sysgo/.buttonslayout
|
||||||
|
sysgo/.lang
|
||||||
|
*.cfg
|
||||||
|
**/Jobs/*
|
||||||
|
!**/Jobs/.gitkeep
|
||||||
|
|
||||||
|
|||||||
53
main.go
53
main.go
@ -7,10 +7,11 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
gotime "time"
|
gotime "time"
|
||||||
"github.com/veandco/go-sdl2/sdl"
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
|
"github.com/cuu/gogame"
|
||||||
"github.com/cuu/gogame/display"
|
"github.com/cuu/gogame/display"
|
||||||
"github.com/cuu/gogame/event"
|
"github.com/cuu/gogame/event"
|
||||||
// "github.com/cuu/gogame/color"
|
// "github.com/cuu/gogame/color"
|
||||||
@ -199,6 +200,33 @@ func InspectionTeam(main_screen *UI.MainScreen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PreparationInAdv(){
|
||||||
|
|
||||||
|
if strings.Contains(runtime.GOARCH,"arm") == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if UI.FileExists("sysgo/.powerlevel") == false {
|
||||||
|
UI.System("touch sysgo/.powerlevel")
|
||||||
|
UI.System("sudo iw wlan0 set power_save off >/dev/null")
|
||||||
|
|
||||||
|
}else{
|
||||||
|
b, err := ioutil.ReadFile("sysgo/.powerlevel")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pwl := strings.Trim(string(b),"\r\n ")
|
||||||
|
|
||||||
|
if pwl == "supersaving" {
|
||||||
|
UI.System("sudo iw wlan0 set power_save on >/dev/null")
|
||||||
|
}else{
|
||||||
|
UI.System("sudo iw wlan0 set power_save off >/dev/null")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func run() int {
|
func run() int {
|
||||||
display.Init()
|
display.Init()
|
||||||
font.Init()
|
font.Init()
|
||||||
@ -206,7 +234,9 @@ func run() int {
|
|||||||
|
|
||||||
UI.Init()
|
UI.Init()
|
||||||
UI.MyIconPool.Init()
|
UI.MyIconPool.Init()
|
||||||
|
|
||||||
|
PreparationInAdv()
|
||||||
|
|
||||||
main_screen := UI.NewMainScreen()
|
main_screen := UI.NewMainScreen()
|
||||||
main_screen.HWND = screen
|
main_screen.HWND = screen
|
||||||
main_screen.Init()
|
main_screen.Init()
|
||||||
@ -243,8 +273,25 @@ func run() int {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if ev.Type == event.USEREVENT {
|
if ev.Type == event.USEREVENT {
|
||||||
|
|
||||||
|
|
||||||
fmt.Println("UserEvent: ",ev.Data["Msg"])
|
fmt.Println("UserEvent: ",ev.Data["Msg"])
|
||||||
|
|
||||||
|
switch ev.Code {
|
||||||
|
case UI.RUNEVT:
|
||||||
|
main_screen.OnExitCb()
|
||||||
|
gogame.Quit()
|
||||||
|
|
||||||
|
fmt.Println("RUNEVT")
|
||||||
|
exec_app_cmd := "cd " + filepath.Dir(ev.Data["Msg"])+";"
|
||||||
|
exec_app_cmd += ev.Data["Msg"]
|
||||||
|
exec_app_cmd +="; sync & cd "+UI.GetExePath()+"; "+os.Args[0]
|
||||||
|
fmt.Println(exec_app_cmd)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if ev.Type == event.KEYDOWN {
|
if ev.Type == event.KEYDOWN {
|
||||||
everytime_keydown = gotime.Now()
|
everytime_keydown = gotime.Now()
|
||||||
|
|||||||
@ -111,6 +111,15 @@ func MakeExecutable(path string) {
|
|||||||
os.Chmod(path,mode)
|
os.Chmod(path,mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetExePath() string {
|
||||||
|
dir, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
return dir
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func ReplaceSuffix(orig_file_str string, new_ext string) string {
|
func ReplaceSuffix(orig_file_str string, new_ext string) string {
|
||||||
orig_ext := filepath.Ext(orig_file_str)
|
orig_ext := filepath.Ext(orig_file_str)
|
||||||
if orig_ext!= "" {
|
if orig_ext!= "" {
|
||||||
@ -226,3 +235,14 @@ func CheckBattery() int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func System(cmd string) string {
|
||||||
|
ret := ""
|
||||||
|
out,err := exec.Command("bash","-c",cmd).Output()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}else {
|
||||||
|
ret = string(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ var (
|
|||||||
SKIN="default"
|
SKIN="default"
|
||||||
|
|
||||||
//load from dot files
|
//load from dot files
|
||||||
CurPowerLevel= "supersaving"//"performance"
|
CurPowerLevel= "performance"
|
||||||
Lang = "English"
|
Lang = "English"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user