Create the variable content as needed instead of simply relying on
statically shipping it at initial install.
This is better aligned with the concepts of stateless systems, factory
reset, ostree, etc.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
The service file already uses the correct path,
so lets create the directory at the right path as well.
Fixes: #3
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
This allows only installing the data files in case the build is done
separately (like for example when using debcargo/dh-cargo which uses
rustc --target option and thus the speakersafetyd ends up in a different
path which includes the target).
While at it also mark all targets as PHONY, since none of them are
backed by an actual file with the same name.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
The M2 based Macbook Pro 13-inch uses tas2764 as speaker amp which uses
a different volume control name compared to j293.
Signed-off-by: Janne Grunau <j@jannau.net>
Use j375 as base for Mac mini/studio devices with tas2764 speaker amp.
The volume control has a different name compared to j274.
Signed-off-by: Janne Grunau <j@jannau.net>
The signal_hook crate makes this easy, but unfortunately insists on
hardcoding SA_RESTART. So we have to then use libc directly to patch
that out...
Still worth using signal_hook for the atomic flag helper though.
Signed-off-by: Hector Martin <marcan@marcan.st>
This makes it more clear that we're matching against Apple machines. The
kernel driver will be updated to use this naming scheme. For backwards
compatibility, we add a rule to rename J313 at runtime (the only enabled
model at this time).
This update must be released together with a matching asahi-audio update
(but the kernel can come later).
Signed-off-by: Hector Martin <marcan@marcan.st>
Disallow nontrivial negative power, but clamp down rounding error to
avoid flickering signs in debug logs.
Signed-off-by: Hector Martin <marcan@marcan.st>
Headroom goes *above* the limit, not below. Replace the max safe temp
thing with a window delta below the limit where attenuation begins.
Signed-off-by: Hector Martin <marcan@marcan.st>
The kernel should clamp this to the correct value. We still read it back
later, to make sure our amp output calculations are correct.
Signed-off-by: Hector Martin <marcan@marcan.st>
Mostly autogenerated from macOS AU preset dumps, with speaker names and
channel orders manually adjusted as necessary.
Signed-off-by: Hector Martin <marcan@marcan.st>
For single-speaker devices, there is no control prefix. So treat the
special name "Mono" as a null prefix in that case.
Signed-off-by: Hector Martin <marcan@marcan.st>
On any panic, we dump out the last ~30 seconds of IVSENSE data along
with the starting state and panic reason.
Also add a feature to panic if the gain reduces too much. This can be
used to try to catch badness.
Signed-off-by: Hector Martin <marcan@marcan.st>
We're not doing explicit error handling, since the kernel is in charge
of safety if we crash. Just panic on anything.
Signed-off-by: Hector Martin <marcan@marcan.st>
ALSA needs special handling to correctly resume after the system is
suspended with a PCM active. Do the required dance.
Signed-off-by: Hector Martin <marcan@marcan.st>