show video debugging info

This commit is contained in:
Siyuan Miao 2025-09-25 17:57:50 +00:00 committed by Siyuan
parent d52773d064
commit f20a7d7022
8 changed files with 78 additions and 2 deletions

View File

@ -393,6 +393,10 @@ jetkvm_video_state_t *jetkvm_video_get_status() {
return &state;
}
char *jetkvm_video_log_status() {
return videoc_log_status();
}
int jetkvm_video_init() {
return video_init();
}

View File

@ -59,6 +59,7 @@ int jetkvm_video_set_quality_factor(float quality_factor);
float jetkvm_video_get_quality_factor();
int jetkvm_video_set_edid(const char *edid_hex);
char *jetkvm_video_get_edid_hex();
char *jetkvm_video_log_status();
jetkvm_video_state_t *jetkvm_video_get_status();
void video_report_format(bool ready, const char *error, u_int16_t width, u_int16_t height, double frame_per_second);

View File

@ -162,6 +162,16 @@ func videoStop() {
C.jetkvm_video_stop()
}
func videoLogStatus() string {
cgoLock.Lock()
defer cgoLock.Unlock()
logStatus := C.jetkvm_video_log_status()
defer C.free(unsafe.Pointer(logStatus))
return C.GoString(logStatus)
}
func uiSetVar(name string, value string) {
cgoLock.Lock()
defer cgoLock.Unlock()

View File

@ -108,6 +108,11 @@ func videoSetStreamQualityFactor(factor float64) error {
return nil
}
func videoLogStatus() string {
panicPlatformNotSupported()
return ""
}
func videoGetEDID() (string, error) {
panicPlatformNotSupported()
return "", nil

Binary file not shown.

View File

@ -36,6 +36,13 @@ func (n *Native) VideoGetEDID() (string, error) {
return videoGetEDID()
}
func (n *Native) VideoLogStatus() (string, error) {
n.videoLock.Lock()
defer n.videoLock.Unlock()
return videoLogStatus(), nil
}
func (n *Native) VideoStop() error {
n.videoLock.Lock()
defer n.videoLock.Unlock()

View File

@ -251,6 +251,10 @@ func rpcSetEDID(edid string) error {
return nil
}
func rpcGetVideoLogStatus() (string, error) {
return nativeInstance.VideoLogStatus()
}
func rpcGetDevChannelState() (bool, error) {
return config.IncludePreRelease, nil
}
@ -1207,6 +1211,7 @@ var rpcHandlers = map[string]RPCHandler{
"setAutoUpdateState": {Func: rpcSetAutoUpdateState, Params: []string{"enabled"}},
"getEDID": {Func: rpcGetEDID},
"setEDID": {Func: rpcSetEDID, Params: []string{"edid"}},
"getVideoLogStatus": {Func: rpcGetVideoLogStatus},
"getDevChannelState": {Func: rpcGetDevChannelState},
"setDevChannelState": {Func: rpcSetDevChannelState, Params: []string{"enabled"}},
"getLocalVersion": {Func: rpcGetLocalVersion},

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { Button } from "@/components/Button";
import { TextAreaWithLabel } from "@/components/TextArea";
@ -52,7 +52,7 @@ export default function SettingsVideoRoute() {
const [customEdidValue, setCustomEdidValue] = useState<string | null>(null);
const [edid, setEdid] = useState<string | null>(null);
const [edidLoading, setEdidLoading] = useState(false);
const { debugMode } = useSettingsStore();
// Video enhancement settings from store
const {
videoSaturation,
@ -132,6 +132,26 @@ export default function SettingsVideoRoute() {
});
};
const [debugInfo, setDebugInfo] = useState<string | null>(null);
const [debugInfoLoading, setDebugInfoLoading] = useState(false);
const getDebugInfo = useCallback(() => {
setDebugInfoLoading(true);
send("getVideoLogStatus", {}, (resp: JsonRpcResponse) => {
if ("error" in resp) {
notifications.error(`Failed to get debug info: ${resp.error.data || "Unknown error"}`);
setDebugInfoLoading(false);
return;
}
const data = resp.result as string;
setDebugInfo(data
.split("\n")
.map(line => line.trim().replace(/^\[\s*\d+\.\d+\]\s*/, ""))
.join("\n")
);
setDebugInfoLoading(false);
});
}, [send]);
return (
<div className="space-y-3">
<div className="space-y-4">
@ -279,6 +299,30 @@ export default function SettingsVideoRoute() {
)}
</Fieldset>
</div>
{debugMode && (
<div className="space-y-4">
<SettingsItem
title="Debugging Info"
description="Debugging information for video"
>
<Button size="SM" theme="primary" text="Get Debugging Info"
loading={debugInfoLoading}
disabled={debugInfoLoading}
onClick={() => {
getDebugInfo();
}} />
</SettingsItem>
{debugInfo && (
<div className="font-mono bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-xs max-h-64 overflow-y-auto">
<pre className="whitespace-pre-wrap">
{debugInfo}
</pre>
</div>
)}
</div>
)}
</div>
</div>
</div>