mirror of https://github.com/jetkvm/kvm.git
chore: initialize usbgadget before native and display (#1010)
This commit is contained in:
parent
8d801fdb3d
commit
56968dede5
20
display.go
20
display.go
|
|
@ -39,6 +39,16 @@ func switchToMainScreen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateDisplayUsbState() {
|
||||||
|
if usbState == "configured" {
|
||||||
|
nativeInstance.UpdateLabelIfChanged("usb_status_label", "Connected")
|
||||||
|
_, _ = nativeInstance.UIObjAddState("usb_status_label", "LV_STATE_CHECKED")
|
||||||
|
} else {
|
||||||
|
nativeInstance.UpdateLabelIfChanged("usb_status_label", "Disconnected")
|
||||||
|
_, _ = nativeInstance.UIObjClearState("usb_status_label", "LV_STATE_CHECKED")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func updateDisplay() {
|
func updateDisplay() {
|
||||||
if networkManager != nil {
|
if networkManager != nil {
|
||||||
nativeInstance.UpdateLabelIfChanged("home_info_ipv4_addr", networkManager.IPv4String())
|
nativeInstance.UpdateLabelIfChanged("home_info_ipv4_addr", networkManager.IPv4String())
|
||||||
|
|
@ -56,13 +66,8 @@ func updateDisplay() {
|
||||||
nativeInstance.UpdateLabelIfChanged("dhcp_client_change_label", "Change to JetKVM")
|
nativeInstance.UpdateLabelIfChanged("dhcp_client_change_label", "Change to JetKVM")
|
||||||
}
|
}
|
||||||
|
|
||||||
if usbState == "configured" {
|
updateDisplayUsbState()
|
||||||
nativeInstance.UpdateLabelIfChanged("usb_status_label", "Connected")
|
|
||||||
_, _ = nativeInstance.UIObjAddState("usb_status_label", "LV_STATE_CHECKED")
|
|
||||||
} else {
|
|
||||||
nativeInstance.UpdateLabelIfChanged("usb_status_label", "Disconnected")
|
|
||||||
_, _ = nativeInstance.UIObjClearState("usb_status_label", "LV_STATE_CHECKED")
|
|
||||||
}
|
|
||||||
if lastVideoState.Ready {
|
if lastVideoState.Ready {
|
||||||
nativeInstance.UpdateLabelIfChanged("hdmi_status_label", "Connected")
|
nativeInstance.UpdateLabelIfChanged("hdmi_status_label", "Connected")
|
||||||
_, _ = nativeInstance.UIObjAddState("hdmi_status_label", "LV_STATE_CHECKED")
|
_, _ = nativeInstance.UIObjAddState("hdmi_status_label", "LV_STATE_CHECKED")
|
||||||
|
|
@ -371,6 +376,7 @@ func initDisplay() {
|
||||||
displayLogger.Info().Msg("setting initial display contents")
|
displayLogger.Info().Msg("setting initial display contents")
|
||||||
time.Sleep(500 * time.Millisecond)
|
time.Sleep(500 * time.Millisecond)
|
||||||
updateStaticContents()
|
updateStaticContents()
|
||||||
|
updateDisplayUsbState()
|
||||||
displayInited = true
|
displayInited = true
|
||||||
displayLogger.Info().Msg("display inited")
|
displayLogger.Info().Msg("display inited")
|
||||||
startBacklightTickers()
|
startBacklightTickers()
|
||||||
|
|
|
||||||
8
main.go
8
main.go
|
|
@ -54,14 +54,14 @@ func Main() {
|
||||||
|
|
||||||
go runWatchdog()
|
go runWatchdog()
|
||||||
|
|
||||||
setProcTitle("initNative")
|
|
||||||
initNative(systemVersionLocal, appVersionLocal)
|
|
||||||
initDisplay()
|
|
||||||
|
|
||||||
// initialize usb gadget
|
// initialize usb gadget
|
||||||
setProcTitle("initUsbGadget")
|
setProcTitle("initUsbGadget")
|
||||||
initUsbGadget()
|
initUsbGadget()
|
||||||
|
|
||||||
|
setProcTitle("initNative")
|
||||||
|
initNative(systemVersionLocal, appVersionLocal)
|
||||||
|
initDisplay()
|
||||||
|
|
||||||
http.DefaultClient.Timeout = 1 * time.Minute
|
http.DefaultClient.Timeout = 1 * time.Minute
|
||||||
|
|
||||||
err = rootcerts.UpdateDefaultTransport()
|
err = rootcerts.UpdateDefaultTransport()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue