Skip to content

Linux Bluetooth HID is classified as USB, so Nomad album art uses the USB chunk path and times out #31

Description

@rickchristie

Summary

Linux Input 0.18.2-Community shows Nomad [E] now-playing over Bluetooth (mp.write_info works) but album art does not. The same board shows art over USB-C.

Input already has a BLE artwork pacer (768-byte chunks, 120ms gap, retries). On Linux BLE it never runs, because discovery marks the hidraw node as USB.

Environment

  • Ubuntu 22.04, GNOME on X11
  • Input 0.18.2-Community
  • Nomad [E] v1 firmware v0.9.0
  • Connection: Bluetooth (HID_ID=0005:0000303A:00008294, hidraw)

What happens

  1. mp.write_info succeeds every ~1s — title/artist/elapsed show on the widget.
  2. mp.write_artwork returns {bytes_written:3072} a few times (~6.5s each), then:
WLDeviceError: Request timed out
RPC operation failed: { code: 'TIMEOUT', message: 'Request timed out' }

JSON-RPC timeout in @worklouder/wl-device-kit is 10s. CHUNK_RAW_BYTE_SIZE is 3072 (base64 cap 4096). That is the USB path.

Root cause

WLDeviceDiscovery.filterWLDevices:

const isUsb = (device.release & 3) === 0;

Firmware encodes USB vs BLE in the low bits of HID bcdDevice / release. On Windows/macOS that bit is trustworthy.

On Linux, BLE keyboards arrive as uhid hidraw (/sys/devices/virtual/misc/uhid/...). node-hid / hidapi reports release = 0 because there is no USB descriptor. (0 & 3) === 0 is treated as USB.

writeArtworkToDevice then calls writeMediaArtwork (3072-byte chunks) instead of the BLE pacer (768-byte chunks). 0.18 already says "album-art transfers are paced over Bluetooth" — that pacer is gated on isUsbConnection === false.

Fix

On Linux, read /sys/class/hidraw/<node>/device/uevent HID_ID bus field:

  • 3 = USB → isUsbConnection = true
  • 5 = Bluetooth → isUsbConnection = false
  • otherwise keep the release & 3 bit-test

After this override we logged discovered /dev/hidraw2 release=0 isUsb=false, artwork went out as 768-byte chunks with a final 524-byte chunk, zero write_artwork timeouts, and album art appeared on the board.

The kit file that needs the change is unpacked:

resources/app.asar.unpacked/node_modules/@worklouder/wl-device-kit/dist/index.js

(source: src/wl_device_discovery/wl_device_discovery.ts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions