Arch Linux - udev rule not always triggeringSetting up surround sound with optical outudev rule for usb...
FPGA CPU's, how to find the max speed?
Finding the package which provides a given command
Intel 8080-based home computers
Fantasy Story About A Boy And Girl That Enter A Fantasy World Pre-1994
Why did Steve Rogers choose this character in Endgame?
Is straight-up writing someone's opinions telling?
What do these three diagonal lines that cross through three measures and both staves mean, and what are they called?
How Can I Process Untrusted Data Sources Securely?
Accidentally deleted python and yum is not working in centos7
Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"
How to determine the optimal threshold to achieve the highest accuracy
Should I be able to keep my company purchased standing desk when I leave my job?
What happens on Day 6?
What happens if there is no space for entry stamp in the passport for US visa?
Is it rude to refer to janitors as 'floor people'?
A scene of Jimmy diversity
Is it OK to use personal email ID for faculty job applications or should we use (current) institute's ID
Is there a standard way of referencing line numbers in a draft?
What are the arguments for California’s nonpartisan blanket (jungle) primaries?
How to ask my office to remove the pride decorations without appearing anti-LGBTQ?
If I stood next to a piece of metal heated to a million degrees, but in a perfect vacuum, would I feel hot?
Do I need a 50/60Hz notch filter for battery powered devices?
What made Windows ME so crash-prone?
How to delete certain lists from a nested list?
Arch Linux - udev rule not always triggering
Setting up surround sound with optical outudev rule for usb attach/detach not triggeringChanging sound chip with ALSAHow to enable both built-in audio output and HDMI audio output with PulseAudio?UDEV Rule Not TriggeringUdev rule not setting groupudev power_supply rules not triggeringHow can I setup pulseaudio to use both digital and analog ports from 2 profiles?udev rule not calleddetecting monitor wakeup
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to make a udev rule, for switching sound output, when HDMI is plugged and not plugged. My bash script is working if I manually call it from the terminal, and therefore the problem must lay on the udev rules.
So far I have been using the code giving on Archs wiki site:
udev and script code
Udev:
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi_sound_toggle.sh"
Script:
#!/bin/bash
export PATH=/usr/bin
USER_NAME=$USER
USER_ID=$(id -u "$USER_NAME")
CARD_PATH="/sys/class/drm/card0/"
AUDIO_OUTPUT="analog-surround-40"
PULSE_SERVER="unix:/run/user/"$USER_ID"/pulse/native"
for OUTPUT in $(cd "$CARD_PATH" && echo card*); do
OUT_STATUS=$(<"$CARD_PATH"/"$OUTPUT"/status)
if [[ $OUT_STATUS == connected ]]
then
echo $OUTPUT connected
case "$OUTPUT" in
"card0-HDMI-A-1")
AUDIO_OUTPUT="hdmi-stereo" # Digital Stereo (HDMI 1)
;;
"card0-HDMI-A-2")
AUDIO_OUTPUT="hdmi-stereo-extra1" # Digital Stereo (HDMI 2)
;;
*)
AUDIO_OUTPUT="analog-stereo"
;;
esac
fi
done
echo selecting output $AUDIO_OUTPUT
exec pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
#sudo -u "$USER_NAME" pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
I have already tryed
- Running the script in terminal, to see if it works, which it does.
- Checked if HDMI is detected with
udevadm monitor, which it sometimes is, and sometimes not.
arch-linux audio udev pulseaudio
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I am trying to make a udev rule, for switching sound output, when HDMI is plugged and not plugged. My bash script is working if I manually call it from the terminal, and therefore the problem must lay on the udev rules.
So far I have been using the code giving on Archs wiki site:
udev and script code
Udev:
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi_sound_toggle.sh"
Script:
#!/bin/bash
export PATH=/usr/bin
USER_NAME=$USER
USER_ID=$(id -u "$USER_NAME")
CARD_PATH="/sys/class/drm/card0/"
AUDIO_OUTPUT="analog-surround-40"
PULSE_SERVER="unix:/run/user/"$USER_ID"/pulse/native"
for OUTPUT in $(cd "$CARD_PATH" && echo card*); do
OUT_STATUS=$(<"$CARD_PATH"/"$OUTPUT"/status)
if [[ $OUT_STATUS == connected ]]
then
echo $OUTPUT connected
case "$OUTPUT" in
"card0-HDMI-A-1")
AUDIO_OUTPUT="hdmi-stereo" # Digital Stereo (HDMI 1)
;;
"card0-HDMI-A-2")
AUDIO_OUTPUT="hdmi-stereo-extra1" # Digital Stereo (HDMI 2)
;;
*)
AUDIO_OUTPUT="analog-stereo"
;;
esac
fi
done
echo selecting output $AUDIO_OUTPUT
exec pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
#sudo -u "$USER_NAME" pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
I have already tryed
- Running the script in terminal, to see if it works, which it does.
- Checked if HDMI is detected with
udevadm monitor, which it sometimes is, and sometimes not.
arch-linux audio udev pulseaudio
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I am trying to make a udev rule, for switching sound output, when HDMI is plugged and not plugged. My bash script is working if I manually call it from the terminal, and therefore the problem must lay on the udev rules.
So far I have been using the code giving on Archs wiki site:
udev and script code
Udev:
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi_sound_toggle.sh"
Script:
#!/bin/bash
export PATH=/usr/bin
USER_NAME=$USER
USER_ID=$(id -u "$USER_NAME")
CARD_PATH="/sys/class/drm/card0/"
AUDIO_OUTPUT="analog-surround-40"
PULSE_SERVER="unix:/run/user/"$USER_ID"/pulse/native"
for OUTPUT in $(cd "$CARD_PATH" && echo card*); do
OUT_STATUS=$(<"$CARD_PATH"/"$OUTPUT"/status)
if [[ $OUT_STATUS == connected ]]
then
echo $OUTPUT connected
case "$OUTPUT" in
"card0-HDMI-A-1")
AUDIO_OUTPUT="hdmi-stereo" # Digital Stereo (HDMI 1)
;;
"card0-HDMI-A-2")
AUDIO_OUTPUT="hdmi-stereo-extra1" # Digital Stereo (HDMI 2)
;;
*)
AUDIO_OUTPUT="analog-stereo"
;;
esac
fi
done
echo selecting output $AUDIO_OUTPUT
exec pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
#sudo -u "$USER_NAME" pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
I have already tryed
- Running the script in terminal, to see if it works, which it does.
- Checked if HDMI is detected with
udevadm monitor, which it sometimes is, and sometimes not.
arch-linux audio udev pulseaudio
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am trying to make a udev rule, for switching sound output, when HDMI is plugged and not plugged. My bash script is working if I manually call it from the terminal, and therefore the problem must lay on the udev rules.
So far I have been using the code giving on Archs wiki site:
udev and script code
Udev:
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi_sound_toggle.sh"
Script:
#!/bin/bash
export PATH=/usr/bin
USER_NAME=$USER
USER_ID=$(id -u "$USER_NAME")
CARD_PATH="/sys/class/drm/card0/"
AUDIO_OUTPUT="analog-surround-40"
PULSE_SERVER="unix:/run/user/"$USER_ID"/pulse/native"
for OUTPUT in $(cd "$CARD_PATH" && echo card*); do
OUT_STATUS=$(<"$CARD_PATH"/"$OUTPUT"/status)
if [[ $OUT_STATUS == connected ]]
then
echo $OUTPUT connected
case "$OUTPUT" in
"card0-HDMI-A-1")
AUDIO_OUTPUT="hdmi-stereo" # Digital Stereo (HDMI 1)
;;
"card0-HDMI-A-2")
AUDIO_OUTPUT="hdmi-stereo-extra1" # Digital Stereo (HDMI 2)
;;
*)
AUDIO_OUTPUT="analog-stereo"
;;
esac
fi
done
echo selecting output $AUDIO_OUTPUT
exec pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
#sudo -u "$USER_NAME" pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo
I have already tryed
- Running the script in terminal, to see if it works, which it does.
- Checked if HDMI is detected with
udevadm monitor, which it sometimes is, and sometimes not.
arch-linux audio udev pulseaudio
arch-linux audio udev pulseaudio
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 48 mins ago
NillerhNillerh
1
1
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Nillerh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Nillerh is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f530542%2farch-linux-udev-rule-not-always-triggering%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Nillerh is a new contributor. Be nice, and check out our Code of Conduct.
Nillerh is a new contributor. Be nice, and check out our Code of Conduct.
Nillerh is a new contributor. Be nice, and check out our Code of Conduct.
Nillerh is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f530542%2farch-linux-udev-rule-not-always-triggering%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown