4 Commits

Author SHA1 Message Date
buster_dylan
baefc0d879 Increase enrollment stages to 10 for better template coverage
More enrollment samples give bz3 a wider spread of touch angles
and positions to build the template from, improving match reliability
on small touch sensors used as tap sensors (e.g. 04f3:0c6e power button).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 00:28:24 +10:00
buster_dylan
1ce6db6e2c Skip active recalibration for unreliable devices
ELAN_CALIBRATION_MAX_DELTA raised to 65535 to prevent the
recalibration state machine from running on devices like 04f3:0c6e
where the 0x01→0x03 status transition is intermittently absent,
causing frequent 'Calibration failed!' session errors. The background
image is still re-captured fresh on each activation — we just skip
the active recalibration handshake.

Also bumps ELAN_CALIBRATION_ATTEMPTS to 100 as a safety net for
devices that do support the full calibration sequence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 00:15:28 +10:00
buster_dylan
9b5d717788 Improve tap-mode reliability for 04f3:0c6e and similar non-blocking devices
Key changes:
- bz3_threshold: 10 → 2 (better match rate on small swipe sensor frames)
- ELAN_MIN_FRAMES: 4 → 1 (accept single-frame captures rather than discarding)
- ELAN_SKIP_LAST_FRAMES: 2 → 0 (use all captured frames; tap mode has no trailing blurry frames)
- ELAN_FINGER_TIMEOUT: 200 → 350ms (more time to re-detect finger between frames)
- Poll delay on non-blocking devices: 50 → 10ms (faster finger detection response)
- Dark frame: mark_failed → mark_completed (don't abort if a frame is below background)

Together these bring verification match rate from ~50% to ~70% on the ASUS 04f3:0c6e sensor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 21:00:43 +10:00
buster_dylan
9abb7a9334 elan: fix protocol error and calibration for ASUS 04f3:0c6e
Some Elan devices (notably 04f3:0c6e on ASUS laptops) do not implement
the blocking behavior of pre_scan_cmd (0x40 0x3f). Instead of holding
the USB response open until a finger is placed, they return immediately
with a non-0x55 value when no finger is present. The existing driver
treated this as a fatal protocol error.

Fix: jump back to CAPTURE_WAIT_FINGER with a 50ms delay instead of
failing, turning the driver into a polling loop that waits for 0x55
(finger present) before proceeding to capture.

Additional tuning for 04f3:0c6e:
- Increase ELAN_CALIBRATION_ATTEMPTS 10->30 and poll delay 50->100ms
- Lower bz3_threshold 24->10 for single-press image matching
- Lower ELAN_MIN_FRAMES 7->4 for short press/tap captures

Tested on Rocky Linux 10.1 (ASUS laptop, FW 0x0161, sensor 150x52).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 20:12:03 +10:00