update: more convenient way to apply udev rules

This commit is contained in:
Jack Shao 2018-10-11 17:54:51 +08:00
parent dfc7b404a5
commit be0812c70b
2 changed files with 46 additions and 16 deletions

View file

@ -0,0 +1,8 @@
SUBSYSTEM!="sound", GOTO="seeedvoicecard_end"
ACTION!="change", GOTO="seeedvoicecard_end"
KERNEL!="card*", GOTO="seeedvoicecard_end"
ATTR{id}=="seeed4micvoicec",ENV{PULSE_PROFILE_SET}="seeed-voicecard-4mic.conf"
ATTR{id}=="seeed8micvoicec",ENV{PULSE_PROFILE_SET}="seeed-voicecard-8mic.conf"
LABEL="seeedvoicecard_end"

View file

@ -1,10 +1,32 @@
# PulseAudio Configuration for seeed-voicecard # PulseAudio Configuration for seeed-voicecard
Following this guide if you want to use your seeed-voicecard as a default source/sink of pulseaudio. Follow this guide if you want to use your seeed-voicecard as a default source/sink of pulseaudio.
### Prerequisites
1. Download PulseAudio
```
sudo apt install -y pulseaudio
```
2. PulseAudio Profiles
```
cd seeed-voicecard/pulseaudio
sudo cp pulse_config_4mic/seeed-voicecard.conf /usr/share/pulseaudio/alsa-mixer/profile-sets/seeed-voicecard-4mic.conf
sudo cp pulse_config_6mic/seeed-voicecard.conf /usr/share/pulseaudio/alsa-mixer/profile-sets/seeed-voicecard-8mic.conf
```
3. Add `udev` Rules
During the system start, when the card "seeed4micvoicec" is detected, the PULSE_PROFILE_SET variable will be set in the udev database, and PulseAudio will be forced to use `seeed-voicecard-4mic.conf`. Similarly, if the card "seeed8micvoicec" is detected, PulseAudio will be forced to use `seeed-voicecard-8mic.conf`.
```
sudo cp 91-seeedvoicecard.rules /etc/udev/rules.d/91-seeedvoicecard.rules
```
### ReSpeaker 4 Mic Array ### ReSpeaker 4 Mic Array
<!--
1. Download pulseaudio 1. Download pulseaudio
``` ```
sudo apt install pulseaudio sudo apt install pulseaudio
@ -72,15 +94,15 @@ sudo cp seeed-voicecard.conf /usr/share/pulseaudio/alsa-mixer/profile-sets/
KERNELS=="platform" KERNELS=="platform"
SUBSYSTEMS=="" SUBSYSTEMS==""
DRIVERS=="" DRIVERS==""
``` ``` -->
4. config `default.pa` and `daemon.conf` 1. config `default.pa` and `daemon.conf`
``` ```
sudo cp default.pa /etc/pulse/ sudo cp pulse_config_4mic/default.pa /etc/pulse/
sudo cp daemon.conf /etc/pulse/ sudo cp pulse_config_4mic/daemon.conf /etc/pulse/
``` ```
5. reboot raspberry pi and check 2. reboot raspberry pi and check
``` ```
sudo reboot sudo reboot
pulseaudio --start # start pulse at first pulseaudio --start # start pulse at first
@ -105,7 +127,7 @@ Cookie: 3b12:70b3
### 6-Mics Circular Array Kit and 4-Mics Linear Array ### 6-Mics Circular Array Kit and 4-Mics Linear Array
<!--
1. Download pulseaudio 1. Download pulseaudio
``` ```
sudo apt install pulseaudio sudo apt install pulseaudio
@ -173,15 +195,15 @@ sudo cp seeed-voicecard.conf /usr/share/pulseaudio/alsa-mixer/profile-sets/
KERNELS=="platform" KERNELS=="platform"
SUBSYSTEMS=="" SUBSYSTEMS==""
DRIVERS=="" DRIVERS==""
``` ``` -->
4. config `default.pa` and `daemon.conf` 1. config `default.pa` and `daemon.conf`
``` ```
sudo cp default.pa /etc/pulse/ sudo cp pulse_config_6mic/default.pa /etc/pulse/
sudo cp daemon.conf /etc/pulse/ sudo cp pulse_config_6mic/daemon.conf /etc/pulse/
``` ```
5. reboot raspberry pi and check 2. reboot raspberry pi and check
``` ```
sudo reboot sudo reboot
pulseaudio --start # start pulse at first pulseaudio --start # start pulse at first