Skip to content

Commit

Permalink
Modified audio config so audio is only enabled after being requested
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed May 29, 2017
1 parent 299e1b9 commit 380a3c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 0 additions & 5 deletions root/etc/modprobe.d/alsa-base.conf

This file was deleted.

10 changes: 8 additions & 2 deletions root/usr/bin/tbsetupaudio
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ def main():
sound_drivers = []
with open('/proc/asound/modules') as f:
for line in f:
sound_drivers = line.split()
sound_drivers.append(line.split())

preferred_device_id = sound_drivers[0]
preferred_device_id = 0

for sound_driver in sound_drivers:
# a sound_driver object looks like ['0', 'snd_bcm2835']
if sound_driver[1] == 'snd_usb_audio':
# prefer USB devices
preferred_device_id = sound_driver[0]

with open(os.path.expanduser('~/.asoundrc'), 'w') as f:
f.write('pcm.!default {{ type plug slave {{ pcm "hw:{d},0" }} }}\nctl.!default {{ type hw card {d} }}'.format(d=preferred_device_id))
Expand Down

0 comments on commit 380a3c5

Please sign in to comment.