rnd-ash/ecu_diagnostics — reverse-engineered prompt
Reverse engineered prompt
Build me a Rust library for talking to car ECUs for diagnostics. I want it to support the common protocols people use, mainly OBD2, KWP2000, and UDS, with a single diagnostic server style API so the caller can pick the protocol when creating it.
Make it safe and hard to send invalid requests by accident. When possible, parse ECU replies into useful Rust data structures instead of just returning raw bytes. Include support for reading current OBD2 data, freeze frame data, vehicle information, reading and clearing DTCs, ECU reset, diagnostic session control, and security access where appropriate.
Please add hardware access behind a common interface so it can work with adapters like Passthru J2534, SocketCAN, SLCAN, and PCAN USB, with CAN and ISO TP support. Include examples that show basic OBD2 use, UDS use, custom services, and C or C++ FFI usage.
Keep it cross platform, documented, and easy to test. Look up current Rust docs online if you need to.
Want more depth? Deep Reverse