@@ -39,6 +39,16 @@ func switchToMainScreen() {
3939 }
4040}
4141
42+ func updateDisplayUsbState () {
43+ if usbState == "configured" {
44+ nativeInstance .UpdateLabelIfChanged ("usb_status_label" , "Connected" )
45+ _ , _ = nativeInstance .UIObjAddState ("usb_status_label" , "LV_STATE_CHECKED" )
46+ } else {
47+ nativeInstance .UpdateLabelIfChanged ("usb_status_label" , "Disconnected" )
48+ _ , _ = nativeInstance .UIObjClearState ("usb_status_label" , "LV_STATE_CHECKED" )
49+ }
50+ }
51+
4252func updateDisplay () {
4353 if networkManager != nil {
4454 nativeInstance .UpdateLabelIfChanged ("home_info_ipv4_addr" , networkManager .IPv4String ())
@@ -56,13 +66,8 @@ func updateDisplay() {
5666 nativeInstance .UpdateLabelIfChanged ("dhcp_client_change_label" , "Change to JetKVM" )
5767 }
5868
59- if usbState == "configured" {
60- nativeInstance .UpdateLabelIfChanged ("usb_status_label" , "Connected" )
61- _ , _ = nativeInstance .UIObjAddState ("usb_status_label" , "LV_STATE_CHECKED" )
62- } else {
63- nativeInstance .UpdateLabelIfChanged ("usb_status_label" , "Disconnected" )
64- _ , _ = nativeInstance .UIObjClearState ("usb_status_label" , "LV_STATE_CHECKED" )
65- }
69+ updateDisplayUsbState ()
70+
6671 if lastVideoState .Ready {
6772 nativeInstance .UpdateLabelIfChanged ("hdmi_status_label" , "Connected" )
6873 _ , _ = nativeInstance .UIObjAddState ("hdmi_status_label" , "LV_STATE_CHECKED" )
@@ -371,6 +376,7 @@ func initDisplay() {
371376 displayLogger .Info ().Msg ("setting initial display contents" )
372377 time .Sleep (500 * time .Millisecond )
373378 updateStaticContents ()
379+ updateDisplayUsbState ()
374380 displayInited = true
375381 displayLogger .Info ().Msg ("display inited" )
376382 startBacklightTickers ()
0 commit comments