summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-12 18:35:22 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-12 18:37:11 +0000
commit9375ecc6a4c30627b54850d6524e900f42e152a1 (patch)
treed2c75a90e81124d4f1ecd790d78870fea9100d83
parentf7fc5b1651da2194cb5c407b35dc9853c06b8ea0 (diff)
add endianness check to spkmodem-recv
a bit dirty. should handle this at runtime. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/spkmodem_recv/spkmodem-recv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c
index db7454ca..f0e8db16 100644
--- a/util/spkmodem_recv/spkmodem-recv.c
+++ b/util/spkmodem_recv/spkmodem-recv.c
@@ -7,7 +7,7 @@
* and decodes them. This is a special type of interface provided
* by coreboot and GRUB, for computers that lack serial ports.
*
- * Usage example:
+ * Usage example (NOTE: little endian!):
* parec --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
*
* Originally provided by GNU GRUB, this version is a heavily
@@ -51,6 +51,13 @@
#define READ_BUF 4096
+/* TODO: handle this at runtime instead (bswap) */
+#if defined(__BYTE_ORDER__)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#error "spkmodem-recv requires little-endian samples"
+#endif
+#endif
+
struct decoder_state {
signed short frame[MAX_SAMPLES];
unsigned char pulse[MAX_SAMPLES];