Skip to content

[BUG] 0416:5302 — CLI theme-load fails for user themes, resume sends wrong theme (HID Type 2) #125

@TowerIRL

Description

@TowerIRL

Description

On a HID Type 2 device (0416:5302), trcc theme-load fails with "Theme not found" for any user-created theme, even though the theme appears correctly in trcc theme-list. Built-in themes (Theme1-5) load fine via CLI. Additionally, trcc resume reports "Sent" but the display does not update. Both operations work correctly via trcc gui. Root cause appears to be settings.user_content_dir returning None in CLI context, causing discover_local_merged to silently skip user themes.

Steps to reproduce

  1. Create a custom theme via trcc gui, save it (mine is named Custom_cyberpunk)
  2. Confirm it appears in trcc theme-list as Custom_cyberpunk (static) [user]
  3. Close the GUI
  4. Run trcc theme-load Custom_cyberpunk
  5. See "Theme not found" error
  6. Run trcc resume — reports "Sent" but display does not change

Expected behavior

trcc theme-load Custom_cyberpunk should find and display the user theme headlessly, the same way built-in themes load. trcc resume should restore the last active theme to the display.

Actual behavior

trcc theme-load Custom_cyberpunk fails with:

Downloading themes 320x240...
Data ready for 320x240.
Error: Theme 'Custom_cyberpunk' not found

trcc resume completes with [usb:1:3] Sent / Resumed 1 device. but display stays on factory default. Also noted that config stores theme_name=Theme1 as last used even after loading a user theme via GUI, so resume is sending the wrong theme regardless.

Traced the issue — settings.user_content_dir is None in CLI context:

python3 -c "from trcc.conf import settings; print(settings.user_content_dir)"
None

This causes discover_local_merged to fail silently on user themes. Built-in themes are unaffected because they use a different lookup path.

Diagnostic report

Run trcc report and paste the output:

trcc report output
────────────────────────────────────────────────────────────
Version
────────────────────────────────────────────────────────────
  trcc-linux:  9.4.7
  Python:      3.14.4
  Installed:   pacman
  Distro:      CachyOS
  OS:          Linux-7.0.0-1-cachyos-x86_64-with-glibc2.43
  Kernel:      7.0.0-1-cachyos

────────────────────────────────────────────────────────────
lsusb (filtered)
────────────────────────────────────────────────────────────
  Bus 001 Device 003: ID 0416:5302 Winbond Electronics Corp. USBDISPLAY

────────────────────────────────────────────────────────────
udev rules (/etc/udev/rules.d/99-trcc-lcd.rules)
────────────────────────────────────────────────────────────
  SUBSYSTEM=="scsi_generic", ATTRS{idVendor}=="0402", ATTRS{idProduct}=="3922", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0402", ATTR{idProduct}=="3922", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5302", MODE="0666"
  SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5302", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5302", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="scsi_generic", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5406", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5406", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5408", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5408", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5409", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="5409", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="8001", MODE="0666"
  SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="8001", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0416", ATTR{idProduct}=="8001", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0418", ATTRS{idProduct}=="5303", MODE="0666"
  SUBSYSTEM=="usb", ATTR{idVendor}=="0418", ATTR{idProduct}=="5303", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0418", ATTR{idProduct}=="5303", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0418", ATTRS{idProduct}=="5304", MODE="0666"
  SUBSYSTEM=="usb", ATTR{idVendor}=="0418", ATTR{idProduct}=="5304", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0418", ATTR{idProduct}=="5304", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="usb", ATTR{idVendor}=="87ad", ATTR{idProduct}=="70db", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="87ad", ATTR{idProduct}=="70db", ATTR{power/autosuspend}="-1"
  SUBSYSTEM=="scsi_generic", ATTRS{idVendor}=="87cd", ATTRS{idProduct}=="70db", MODE="0666"
  ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="87cd", ATTR{idProduct}=="70db", ATTR{power/autosuspend}="-1"

────────────────────────────────────────────────────────────
SELinux
────────────────────────────────────────────────────────────
  SELinux not installed

────────────────────────────────────────────────────────────
RAPL power sensors
────────────────────────────────────────────────────────────
  intel-rapl:0: mode=444  readable
  intel-rapl:0:0: mode=444  readable

────────────────────────────────────────────────────────────
Dependencies
────────────────────────────────────────────────────────────
  PySide6: 6.11.0
  pyusb: 1.3.1
  hidapi: not installed

────────────────────────────────────────────────────────────
Detected devices
────────────────────────────────────────────────────────────
  [1] 0416:5302  USBDISPLAY  (HID)  path=usb:1:3

────────────────────────────────────────────────────────────
Device permissions
────────────────────────────────────────────────────────────
  group plugdev: member
  group dialout: (does not exist on this system)
  group disk: NOT member
  group usb: (does not exist on this system)
  /dev/sg0: mode=660  NO ACCESS
  /dev/sg1: mode=660  NO ACCESS
  /dev/sg2: mode=660  NO ACCESS
  /dev/sg3: mode=660  NO ACCESS

Note: Device is HID-based and functioning correctly via GUI, so sg* permissions are likely unrelated.

────────────────────────────────────────────────────────────
Handshakes
────────────────────────────────────────────────────────────

  0416:5302 — HID-LCD (Type 2)
    PM=52 (0x34), SUB=0 (0x00), FBL=52, resolution=320x240, encoding=RGB565-LE rotated
    raw[0:64]=dadbdcdd003400000000000001000000100000004250304d3036380100a4652143035978

────────────────────────────────────────────────────────────
Config
────────────────────────────────────────────────────────────
  path: /home/xxxxx/.trcc/config.json
  installed_resolutions: ['320x240']
  format_prefs: {'temp_unit': 0}
  install_info: method=pacman, distro=cachyos
  devices (1 configured):
    [0] vid_pid=0416_5302, brightness_level=50, rotation=0, split_mode=0, theme_name=Theme1, theme_type=local

────────────────────────────────────────────────────────────
Installed themes
────────────────────────────────────────────────────────────
  320x240: themes=5 masks=110

────────────────────────────────────────────────────────────
Sensor availability
────────────────────────────────────────────────────────────
  psutil: OK (cpu=1.2%)
  psutil temps: ['nvme', 'amdgpu', 'k10temp', 'spd5118']
  pynvml (NVIDIA): not installed (optional)
  hwmon nodes: 8 (spd5118, k10temp, amdgpu, nvme, r8169_0_800:00, spd5118)

────────────────────────────────────────────────────────────
CPU baseline (last theme cache)
────────────────────────────────────────────────────────────
  (not found — load a theme in the GUI first)

────────────────────────────────────────────────────────────
Recent log (last 50 lines)
────────────────────────────────────────────────────────────
  2026-04-19 03:32:02 [DEBUG] [-] trcc.adapters.system.linux.platform.create_setup: create_setup: creating LinuxSetup
  2026-04-19 03:32:02 [DEBUG] [-] trcc.cli._make_cli_renderer: Creating QApplication for CLI renderer (offscreen)
  2026-04-19 03:32:02 [DEBUG] [-] trcc.cli._make_cli_renderer: CLI renderer initialised: QtRenderer (offscreen)
  2026-04-19 03:32:02 [DEBUG] [-] trcc.cli._system.report: collecting diagnostic report
  2026-04-19 03:32:02 [INFO] [-] trcc.adapters.device.detector._detect: Detected 1 device(s): Winbond USBDISPLAY [hid]
  2026-04-19 03:32:02 [DEBUG] [-] trcc.adapters.device.factory._ensure_transport: Opening hid transport: 0416:5302
  2026-04-19 03:32:02 [DEBUG] [-] trcc.adapters.device.hid._detect_endpoints: Auto-detected endpoints: OUT=0x02 IN=0x81
  2026-04-19 03:32:02 [INFO] [-] trcc.adapters.device.factory._do_handshake: HID handshake OK: PM=52, FBL=52, resolution=(320, 240)

============================================================

  TRCC Doctor — CachyOS

  [OK]  Python 3.14.4
  [OK]  PySide6 6.11.0
  [OK]  numpy 2.4.4
  [OK]  psutil 7.2.2
  [OK]  pyusb 1.3.1
  [--]  hidapi not installed (optional)
  [OK]  AMD GPU (sensors via sysfs)
  [OK]  libusb-1.0
  [OK]  sg_raw
  [OK]  7z
  [OK]  ffmpeg
  [OK]  udev rules (/etc/udev/rules.d/99-trcc-lcd.rules)
  [OK]  RAPL power sensors (2 domain(s))
  [OK]  polkit policy installed

  All required dependencies OK.

Logs / tracebacks

Terminal output
# trcc theme-load Custom_cyberpunk (GUI closed)
Downloading themes 320x240...
Downloading web 320x240...
Downloading masks 320x240...
Downloading web 240x320...
Downloading masks 240x320...
Data ready for 320x240.
Error: Theme 'Custom_cyberpunk' not found

# trcc resume (after loading Custom_cyberpunk in GUI and closing it)
Downloading themes 320x240...
Data ready for 320x240.
[usb:1:3] Sent
Resumed 1 device.
(display stays on factory default — no visible change)

# Second attempt with GUI open simultaneously shows device conflict:
02:27:26 [WARNING] [-] trcc.adapters.device.factory.handshake: HID 0416:5302 type 2 in use by another process
02:27:26 [WARNING] [lcd:0 [0416:5302 FBL=None PM=0 SUB=0]] trcc.core.device.lcd:0 initialize_pipeline: initialize_pipeline (0, 0)
02:27:26 [WARNING] [-] trcc.core.app._ensure_data_blocking: skip usb:1:3 — resolution (0,0)
Error: Theme 'Custom_cyberpunk' not found

Screenshots

N/A — terminal-only reproduction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions