Fix sff panic deadlock, share the evdev probe, assorted review cleanups

This commit is contained in:
flamingcow
2026-08-31 15:51:52 -07:00
parent 10d97ee82a
commit e4731c94cd
13 changed files with 205 additions and 272 deletions
+8 -2
View File
@@ -12,8 +12,10 @@ import (
"net/http"
"os"
"sync"
"time"
"g.fc.run/theater/cabletest/internal/drm"
"g.fc.run/theater/cabletest/internal/evdev"
)
const streamAddr = ":8080"
@@ -115,7 +117,7 @@ func serveStream() error {
if err != nil {
return err
}
if touchscreen, err = openTouchscreen(); err != nil {
if touchscreen, err = evdev.FindTouchscreen(os.O_RDWR); err != nil {
return err
}
ln, err := net.Listen("tcp", streamAddr)
@@ -158,7 +160,10 @@ func keys(w http.ResponseWriter, r *http.Request) {
// Between runs the crtc scans out the console framebuffer, which is not a
// dumb buffer and fails to map on every frame; each error reads once, not at
// frame rate.
// frame rate. The pause paces the retry, since a failure ahead of the vblank
// wait would otherwise spin hot.
const captureErrPause = 100 * time.Millisecond
func captureLoop(g *grabber) {
lastErr := ""
for {
@@ -168,6 +173,7 @@ func captureLoop(g *grabber) {
lastErr = err.Error()
fmt.Fprintf(os.Stderr, "capture: %v\n", err)
}
time.Sleep(captureErrPause)
continue
}
lastErr = ""