Add flippercheck: a validator for .sub / .ir / RTTTL / playlist files#687
Open
munzzyy wants to merge 1 commit into
Open
Add flippercheck: a validator for .sub / .ir / RTTTL / playlist files#687munzzyy wants to merge 1 commit into
munzzyy wants to merge 1 commit into
Conversation
Static checker for the file types this repo is full of. Reads a file and reports what would break it on a real Flipper - wrong key length, a RAW capture with a stray line in the middle, a frequency the CC1101 can't tune, a pause long enough to overflow the transmit timer. Never transmits, no Flipper needed to run it. Pure Python 3, stdlib only. Tests included, checked against the good and bad fixtures plus every .sub file in this repo (11k+, zero false positives) and the .ir files. It also found a handful of genuinely broken files here, including the Sub-GHz/Sleep_Files overflow that matches the old 'sleep files don't delay' reports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
flippercheck, a small static checker for the file types this repo is full of -.sub,.ir, RTTTL music, and Sub-GHz playlists. It reads files and reports what would break on a real Flipper. It never transmits and doesn't need a Flipper plugged in. Pure Python 3, standard library only, one script.Why: files rot quietly here - a key that's the wrong length, a RAW capture with a stray line in the middle, a frequency the CC1101 can't tune, a pause long enough to overflow the transmit timer - and none of it shows up until you try to send. There was an IR-only linter (darmiel/fff-ir-lint) but nothing checked
.subfiles, and it's been untouched since 2024. This covers all four in one tool.The rules come from the Flipper firmware source and the CC1101 datasheet, then checked against the real files in this repo. Where the firmware tolerates something the docs forbid, it follows the firmware - e.g. RAW captures that start on a negative value are fine, so they aren't flagged. I ran it across every
.subfile in the repo (11k+) to make sure it doesn't cry wolf on good files.Running it here actually turned up a few genuinely broken files, e.g.:
Sub-GHz/Sleep_Files/*encode a multi-hour pause as one RAW value (~-2,000,000,000 us), past the firmware's 30-bit transmit limit, so it truncates to a wrong delay - that matches the old "sleep files don't delay" reports.Usage and the full list of checks are in
flippercheck/README.md. Tests:python3 flippercheck/tests/test_flippercheck.py. Happy to adjust placement or anything else.