Add chandra-remote: VNC and web control over Tailscale
CI / test (push) Failing after 50s

- remote/: shared-memory framebuffer mirror served as RFB 3.8 (VNC, port 5900) and an HTTP/WebSocket PWA (port 6080), bound to the Tailscale interface and loopback by default
- Compositor: remote pointer, button, scroll, modifier, key, key-tap, text and clipboard input, routed past OLED blanking
- chandra-ctl: add status, refresh and osk commands; add input-* and clipboard-set for remote control
- Camera: debayer 10-bit CSI-2 Quad-Bayer frames for imx371 and high-quality still capture
- Camera: rotate frames by the libcamera mounting angle (CCW for 90), fix the expected test values, and restyle the UI for a dark theme
This commit is contained in:
nandi committed 2026-11-28 17:57:55 -08:00
1 parent de39b74282
commit bfc60ee0e5
24 files changed
+5310 -79

No files matched your search

+41 -4
View File
@@ -56,13 +56,13 @@ class TestCameraHelpers(unittest.TestCase):
bgr90 = cam_mod.convert_frame(buf, w, h, stride, "ABGR8888", rot=90, cv2_mod=cv2, np_mod=np)
self.assertEqual(bgr90.shape, (2, 3, 3))
# Clockwise 90 deg puts original (row=0, col=0) at (row=0, col=h-1=2)
self.assertEqual(tuple(bgr90[0, 2]), (200, 20, 10))
# Libcamera Rotation=90 (CCW mounting) rotates CCW: (row=0, col=0) -> (row=w-1=1, col=0)
self.assertEqual(tuple(bgr90[1, 0]), (200, 20, 10))
bgr270 = cam_mod.convert_frame(buf, w, h, stride, "ABGR8888", rot=270, cv2_mod=cv2, np_mod=np)
self.assertEqual(bgr270.shape, (2, 3, 3))
# Counter-clockwise 90 deg puts original (row=0, col=0) at (row=w-1=1, col=0)
self.assertEqual(tuple(bgr270[1, 0]), (200, 20, 10))
# Libcamera Rotation=270 rotates CW: (row=0, col=0) -> (row=0, col=h-1=2)
self.assertEqual(tuple(bgr270[0, 2]), (200, 20, 10))
@unittest.skipUnless(HAS_CV2_NUMPY, "requires cv2 and numpy")
def test_convert_argb_rgb_and_cairo_bgra(self):
@@ -87,6 +87,43 @@ class TestCameraHelpers(unittest.TestCase):
even = cam_mod.ensure_even_frame(odd)
self.assertEqual(even.shape, (100, 202, 3))
@unittest.skipUnless(HAS_CV2_NUMPY, "requires cv2 and numpy")
def test_debayer_quad_csi2p(self):
# Construct an 8x8 CSI-2 10-bit packed 4x4 Quad-Bayer SRGGB image:
# Top half (rows 0..3): strong red (R=200, G=24, B=24)
# Bottom half (rows 4..7): strong blue (R=24, G=24, B=200)
w, h, stride = 8, 8, 10
arr = np.zeros((h, stride), dtype=np.uint8)
for y in range(h):
top = y < 4
for x_blk in range(2): # 4 pixels per block, 5 bytes per block
# Row phase inside 4x4 Quad-Bayer: y%4 in {0,1} -> R,R,G,G; {2,3} -> G,G,B,B
if (y % 4) < 2:
c0 = 200 if top else 24 # R
c1 = 24 # G
else:
c0 = 24 # G
c1 = 24 if top else 200 # B
base = x_blk * 5
arr[y, base + 0] = c0
arr[y, base + 1] = c0
arr[y, base + 2] = c1
arr[y, base + 3] = c1
arr[y, base + 4] = 0
raw = arr.tobytes()
out_live = cam_mod.debayer_quad_csi2p(
raw, w, h, stride, rot=90, target_size=None, high_quality=False, cv2_mod=cv2, np_mod=np
)
out_hq = cam_mod.debayer_quad_csi2p(
raw, w, h, stride, rot=0, target_size=(6, 4), high_quality=True, cv2_mod=cv2, np_mod=np
)
self.assertEqual(out_live.shape, (4, 4, 3)) # 8x8 -> 4x4, rot=90 keeps 4x4
self.assertEqual(out_hq.shape, (4, 6, 3)) # resized to WxH = 6x4
# Top row in rot=0 should have R > B; bottom row should have B > R.
self.assertGreater(float(out_hq[0, :, 2].mean()), float(out_hq[0, :, 0].mean()) + 30.0)
self.assertGreater(float(out_hq[3, :, 0].mean()), float(out_hq[3, :, 2].mean()) + 30.0)
if __name__ == "__main__":
unittest.main()