summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
28 hoursutil/nvmutil: restrict pointers in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: check gbe file type before writeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: check gbe file size before writeLeah Rowe
re-check. very unlikely since the program doesn't run for very long, but we have to check if the file has changed. this is a basic check of file size. we could probably check the contents too, but that would be overkill. Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursutil/nvmutil: lock gbe fileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursutil/nvmutil: don't allow symlinksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursnvmutil: fix bound check in last commitLeah Rowe
i was fixing the size, but it should be calculated properly. Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursutil/nvmutul: remove unused arg in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursutil/nvmutil: block bad offset in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursutil/nvmutil: stricter i/o arg checksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
30 hoursutil/nvmutil: stricter i/o length checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursutil/nvmutil: rename len to nrw in i/oLeah Rowe
consistent with prw() i prefer nrw (number of rw operations) Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursutil/nvmutil: tidy up prw()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursutil/nvmutil: block O_APPEND in prw()Leah Rowe
O_APPEND allows writes at EOF, thus breaking positional read/write Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursutil/nvmutil: stricter i/o errorsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursutil/nvmutil: fix entropy issueLeah Rowe
the time difference used here could go negative, which would overflow in the xor op on mix, leading to a biased entropy pool. we want to ensure that they numbers do not overflow, because here they are cast to unsigned which would then produce very large numbers. Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursnvmutil: cast integer in printfLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
32 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
32 hoursutil/nvmutil: check defines/enum via assertLeah Rowe
not at runtime Signed-off-by: Leah Rowe <leah@libreboot.org>
32 hoursutil/nvmutil: r_type check in rw_gbe_file_partLeah Rowe
i already send the right arg anyway. this is a preventative bug fix against future maintenance. Signed-off-by: Leah Rowe <leah@libreboot.org>
39 hoursutil/nvmutil: remove pointless checkLeah Rowe
already checked below, then err() Signed-off-by: Leah Rowe <leah@libreboot.org>
39 hoursutil/nvmutil: add missing castLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
39 hoursutil/nvmutil: err in rw_file_exact on zero returnLeah Rowe
zero never occurs, because rw_file_once never returns zero, but only rw_file_once determines that. rw_file_exact must handle every possible error. right now, if that call returns zero, rw_file_exact would have an infinite loop. this doesn't actually happen at the moment, so this is a preventative bug fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: increment rc at end of rw_file_exactLeah Rowe
for fussy static analysers and/or compilers Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: further tidy up prw()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: clean up i/o functionsLeah Rowe
properly verify the value of the arguments, with asserts. add simpler runtime checks in-function, on prw, rw_file_once and rw_file_exact. variable names in english now, and the code is cleaner, while being functionally equivalent. Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: further tidy up rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: minor cleanup: rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: remove dead codeLeah Rowe
useless check. will never be true. Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: remove pointless commentLeah Rowe
itt's totally obvious Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: reduced indentation in rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/spkmodem-decode: add CHAR_BIT defineLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursspkmodem-decode: edge detection *and* amplitudeLeah Rowe
for pulses, we currently use amplitude detection. edge detection is better, because weak / low gain signals will be more reliable. if audio is coming in on/from a system that does automatic gain adjustment, this once again is more robust too. microphones and speakers (which people often use with spkmodem if nothing else available) often clamp amplitude, to an extent that this software may not detect those pulses reliably that way. so we detect slope edges instead. this causes very little performance penalty (use of abs(), that's about it) however, edge detection is inherently vulnerable to noise, so we will also detect amplitude. this acts as an effective noise filter, while still improving pulse detection. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: reset calibration accumulatorsLeah Rowe
in select_separator_tone, i never reset these after computing their average. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursutil/spkmodem-decode: remove dead codeLeah Rowe
this check no longer applies (never triggers) is_signal_valid already guarantees that the separator tone is valid. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: small cleanup in decode_pulseLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: don't select sep tone on bad signalLeah Rowe
otherwise, calibration could collect garbage data. this improves noise mitigation. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: ignore invalid frames when setting bitsLeah Rowe
bits are currently assembled even on invalid frames. this patch fixes that - the bug is also in the GNU version. this reduces the chance of noise/calibration from creating corrupt character output during operation. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: reset char if separator disappearsLeah Rowe
improves reliability in the case when audio cuts out, mic glitches, laptop audio power saving, etc. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: fix single-tone learning bugLeah Rowe
enforce at least two tones. this mitigates the chance of random noise being treated as a real tone, and reduces the chance of broken thresholds versus freq min/max e.g. freq min 31, max 32 and threshold 31 Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: enforce calibrated seperator rangeLeah Rowe
we weren't actually using what we calculated. this patch fixes that, thus preventing random noise / microphone clicks, random artifacts and such from being treated as real frames (the purpose of is_valid_signal is partly noise suppression). Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursspkmodem-decode: fix wrong sample countLeah Rowe
in handle audio, i do the number of samples per frame, and one more. e.g. 241 instead of 240. this bug is in the original GNU version too. this patch fixes it. this means that the output could slowly go out of sync with calculated timings. the patch fixes that. in practise, the decoder is not that sensitive, and the code would adjust anyway (automatic timing adjustment), but ideally we want to not *cause* such issues even if we mitigate them. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursRevert "util/spkmodem-decode: fix 3-frame timeout"Leah Rowe
This reverts commit dbf0c3ccc276eeb7e4d80efe75bdd684cc3c6444.
44 hoursutil/spkmodem-decode: clarify frame count on checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursutil/spkmodem-decode: static assertsLeah Rowe
assert integer sizes, important in this program because we make several implicit assumptions about word sizes, and integers need to be of a certain size. Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursutil/spkmodem-decode: annotate prototypesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/spkmodem-decode: rename function for clarityLeah Rowe
collect_separator should be select_separator, to bring it in line with select_low_tone this just makes the code a bit easier to read Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/spkmodem-decode: tidy up indentationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursfix typo in commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/spkmodem-decode: fix 3-frame timeoutLeah Rowe
i accidentally left this reset here during a previous refactor. Signed-off-by: Leah Rowe <leah@libreboot.org>
46 hoursutil/spkmodem-decode: rename auto_detect_toneLeah Rowe
auto seems redundant. detect implies auto. Signed-off-by: Leah Rowe <leah@libreboot.org>