{"record":{"id":"5d2d6ca5b2f9f917","repo":"AprilNEA/OpenLogi","slug":"dpi-write-failed-requested-target-device-still-reports","errorCode":null,"errorMessage":"DPI write failed: requested {target}, device still reports {before}","messagePattern":"DPI write failed: requested (.+?), device still reports (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/diag/dpi.rs","lineNumber":76,"sourceCode":"        return Ok(());\n    }\n\n    println!(\"  writing DPI: {target}\");\n    openlogi_hid::set_dpi(&route, target)\n        .await\n        .context(\"write DPI\")?;\n\n    let after = openlogi_hid::get_dpi(&route)\n        .await\n        .context(\"read DPI after write\")?;\n    println!(\"  read-back DPI: {after}\");\n\n    // `target` is always a device-reported value, so a mismatch means the\n    // device adjusted it — fine if it landed on another supported value, but a\n    // no-op write (`after == before`) or an off-list read-back is a real fault.\n    // (`target != before` is guaranteed by the early return above.)\n    if after == before {\n        anyhow::bail!(\"DPI write failed: requested {target}, device still reports {before}\");\n    }\n    if after != target {\n        if info.capabilities.contains(after) {\n            println!(\"  note: device snapped {target} → {after}\");\n        } else {\n            anyhow::bail!(\n                \"DPI write failed: requested {target}, device reports {after} \\\n                 which is not in its supported list\"\n            );\n        }\n    }\n\n    println!(\"  restoring DPI: {before}\");\n    openlogi_hid::set_dpi(&route, before)\n        .await\n        .context(\"restore DPI\")?;\n\n    println!(\"✓ DPI round-trip OK\");","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/diag/dpi.rs#L58-L94","documentation":"Round-trip verification failure in `openlogi diag dpi`: the set_dpi write was accepted, but the post-write read-back returns exactly the pre-write DPI, meaning the device applied nothing. Because the requested target was already validated against the device's supported list and is guaranteed different from the current value, a no-op read-back can only indicate a device/firmware fault (write silently ignored), not a bad input, so the diagnostic bails instead of reporting success.","triggerScenarios":"Thrown at crates/openlogi-cli/src/cmd/diag/dpi.rs:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the diagnostic — transient HID++ write failures can present as silent no-ops","Power-cycle or re-pair the device and retry","Try a different supported --target value to see whether all writes or just one step are ignored","Compare with other diag round-trips to isolate whether the device's write path is generally broken"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8","analyzedAt":"2026-09-13T03:07:16.451Z","contentChangedAt":"2026-09-13T03:07:16.451Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}