better ALSA card name
Danny Kukawka
danny.kukawka at web.de
Tue Jan 9 07:36:21 PST 2007
On Tuesday 09 January 2007 12:37, Matthias Kretz wrote:
> Hi,
>
> I'm trying to use the information from HAL to list audio devices, but all
> USB devices are simply identified as USB Audio Interface/USB Audio. There's
> more information available, but from what I've found it's only available
> through /proc/asound/cards and the ALSA ctl interface.
>
> As a proof of concept I added a alsa.name property to alsa pcm devices that
> reads the name from /proc/asound/cards. With this I get:
>
[...]
>
> The alsa.name property is the name I would like to show the user to select
> the audio device. Please review the string code (I'm used to C++ string
> classes...) and let me know whether the new property is ok, or where to put
> the name instead.
As your patch looks you use a older version of HAL code (nearly a half year
old). I would propose you test your hardware with a newer HAL version or HAL
git before we can discuss this code, since we had some changes in the ALSA
code.
I have e.g. this information at may hardware and the patch give me no more
usefull information I don't have already:
udi = '/org/freedesktop/Hal/devices/pci_8086_24c5_alsa_capture_1'
alsa.card_id = 'I82801DBICH4' (string)
linux.device_file = '/dev/snd/pcmC0D1c' (string)
alsa.device_file = '/dev/snd/pcmC0D1c' (string)
info.capabilities = {'alsa'} (string list)
alsa.type = 'capture' (string)
info.udi = '/org/freedesktop/Hal/devices/pci_8086_24c5_alsa_capture_1'
(string)
alsa.physical_device = '/org/freedesktop/Hal/devices/pci_8086_24c5'
(string)
alsa.pcm_class = 'unknown' (string)
alsa.device_id = 'Intel 82801DB-ICH4 - MIC ADC' (string)
linux.subsystem = 'sound' (string)
alsa.card = 0 (0x0) (int)
alsa.name = 'Intel 82801DB-ICH4 with STAC9750,51' (string)
info.product = 'Intel 82801DB-ICH4 - MIC ADC ALSA Capture Device' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.sysfs_path = '/sys/class/sound/pcmC0D1c' (string)
info.category = 'alsa' (string)
alsa.device = 1 (0x1) (int)
info.parent = '/org/freedesktop/Hal/devices/pci_8086_24c5' (string)
Btw. IMO the patch can IMO produce a segfault in this area since strstr() can
return a NULL:
end = strstr (alsaname, " at ");
end[0] = '\0';
Instead of 'alsaname += 22;' to remove whitespaces you should use: "alsaname =
g_strchug(alsaname);".
Danny
More information about the hal
mailing list