On 09/28/2014 05:50 PM, Tanu Kaskinen wrote: > On Sun, 2014-09-28 at 12:41 +0300, Tanu Kaskinen wrote: >> On Mon, 2014-09-22 at 11:50 +0800, Hui Wang wrote: >>> On a machine without fixed connecting audio devices like internal >>> microphone or internal speaker, and when there is no external audio >>> devices plugging in, the default source/sink is alsa_input/alsa_output >>> and there is no input devices/output devices listed in the gnome >>> sound-setting. >> How can the default source/sink be alsa_input/alsa_output if there are >> no alsa devices? > Answering myself: probably you meant that there are alsa devices, but > they are currently all unavailable. Yes, and below is an example: * index: 2 name: <alsa_input.pci-0000_00_14.2.analog-stereo> driver: <module-alsa-card.c> flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY state: SUSPENDED suspend cause: IDLE priority: 9959 volume: 0: 21% 1: 21% 0: -40.50 dB 1: -40.50 dB balance 0.00 base volume: 13% -52.50 dB volume steps: 65537 muted: no current latency: 0.00 ms max rewind: 0 KiB sample spec: s16le 2ch 44100Hz channel map: front-left,front-right Stereo used by: 0 linked by: 0 configured latency: 0.00 ms; range is 0.50 .. 371.52 ms card: 1 <alsa_card.pci-0000_00_14.2> module: 6 properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "92HD89E2 Analog" alsa.id = "92HD89E2 Analog" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "1" alsa.card_name = "HD-Audio Generic" alsa.long_card_name = "HD-Audio Generic at 0xfeb40000 irq 16" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:14.2" sysfs.path = "/devices/pci0000:00/0000:00:14.2/sound/card1" device.bus = "pci" device.vendor.id = "1022" device.vendor.name = "Advanced Micro Devices, Inc. [AMD]" device.product.id = "780d" device.product.name = "FCH Azalia Controller" device.form_factor = "internal" device.string = "front:1" device.buffering.buffer_size = "65536" device.buffering.fragment_size = "32768" device.access_mode = "mmap+timer" device.profile.name = "analog-stereo" device.profile.description = "Analog Stereo" device.description = "Built-in Audio Analog Stereo" alsa.mixer_name = "IDT 92HD89E2" alsa.components = "HDA:111d76c7,103c2b17,00100102" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" ports: analog-input-microphone-front: Front Microphone (priority 8500, latency offset 0 usec, available: no) properties: device.icon_name = "audio-input-microphone" analog-input-microphone-rear: Rear Microphone (priority 8200, latency offset 0 usec, available: no) properties: device.icon_name = "audio-input-microphone" analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no) properties: active port: <analog-input-linein> > >>> Under this situation, if we connect a bluetooth headset, the gnome >>> sound-setting will list bluez input/output devices, but they are not >>> active devices by default. This looks very weird that sound-setting >>> lists only one input device and one output device, but they are not >>> active. To change this situation, we add an argument, the policy is >>> if a new source/sink is connected and current default source/sink's >>> active_port is AVAILABLE_NO, we let the new added one switch to >>> default one. >> Surely it doesn't make any sense to have the default sink/source point >> to non-existing devices if there are other devices available. To me this >> seems like something to fix in the core than working around in modules. >> >> I happen to have some code that improves the core default device >> tracking. I can submit a patch next week. It might fix your issue too. > My code doesn't take the port availability into account (perhaps it > should, I'm not sure), so probably it won't fix your problem. >