Skip to content

Instantly share code, notes, and snippets.

@highgain86j
Created November 5, 2018 13:07
Show Gist options
  • Save highgain86j/7a0f742a8271caefa2936055419df83d to your computer and use it in GitHub Desktop.
Save highgain86j/7a0f742a8271caefa2936055419df83d to your computer and use it in GitHub Desktop.
udev rules
SUBSYSTEM!="sound", GOTO="my_audio_end"
ACTION=="add", GOTO="my_usb_audio_add"
ACTION=="remove", GOTO="my_usb_audio_remove"
ACTION!="add", ACTION!="remove", GOTO="my_usb_audio_end"
LABEL="my_usb_audio_add"
ATTRS{idVendor}=="279d", ATTRS{idProduct}=="0006", ATTR{id}="sa9023", ATTR{index}="-2"
ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0004", ATTR{id}="cm6631a", ATTR{index}="-2"
ACTION=="add", GOTO="my_usb_audio_add_run"
LABEL="my_usb_audio_add_run"
ATTRS{idVendor}=="279d", ATTRS{idProduct}=="0006", RUN+="/usr/bin/amixer -csa9023 set PCM '100%'"
ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0004", TAG+="systemd", ENV{SYSTEMD_WANTS}="shairport-sync.service"
ACTION=="add", GOTO="my_usb_audio_end"
LABEL="my_usb_audio_remove"
ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0004", RUN+="/bin/systemctl stop shairport-sync.service"
ACTION=="remove", GOTO="my_usb_audio_end"
LABEL="my_usb_audio_end"
ACTION=="add", GOTO="my_misc_audio_add"
ACTION=="remove", GOTO="my_misc_audio_remove"
ACTION!="add", ACTION!="remove", GOTO="my_misc_audio_end"
LABEL="my_misc_audio_add"
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card?", ATTR{id}="alc262", ATTR{index}="0"
ACTION=="add", GOTO="my_misc_audio_add_run"
LABEL="my_misc_audio_add_run"
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card?", RUN+="/usr/bin/amixer -calc262 set Master '0%'"
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card?", RUN+="/usr/bin/amixer -calc262 set Headphone '0%'"
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card?", RUN+="/usr/bin/amixer -calc262 set Speaker '0%'"
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card?", RUN+="/usr/bin/amixer -calc262 set Line '0%'"
DEVPATH=="/devices/pci0000:00/0000:00:1b.0/sound/card?", RUN+="/usr/bin/amixer -calc262 set 'Line Out' '0%'"
ACTION=="add", GOTO="my_misc_audio_end"
LABEL="my_misc_audio_remove"
ACTION=="remove", GOTO="my_misc_audio_end"
LABEL="my_misc_audio_end"
LABEL="my_audio_end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment