|
发表于 2008-11-25 01:26:39
|
显示全部楼层
这边好像有解决方案:
http://forums.gentoo.org/viewtopic-t-375470.html
I bought a pair of usb speakers and wanted alsa to automatically switch to the usb-audio card when the device is plugged into the usb port. First, make sure you have usb-audio configured. Plugin the speakers and cat /proc/asound/cards. You should see your usb-audio device. Then put the following 代码:
#!/bin/sh
CARDNUM=`sed -n 's/\(^[0-9]\).*/\1/p' < /proc/asound/cards | tail -n 1`
cat<<EOF > /etc/asound.conf
pcm.!default {
type hw
card $CARDNUM
}
ctl.!default {
type hw
card $CARDNUM
}
EOF
in /etc/dev.d/sound/alsa-default.dev (name is unimportant, but must end in .dev). Make it executable. Whenever there is a sound hotplug event, the default alsa card will be the last one listed in /proc/asound/cards. This also works when the speakers are unplugged (returns to card 0).
不知道可行否 |
|