better ALSA card name

Matthias Kretz kretz at kde.org
Tue Jan 9 03:37:19 PST 2007


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:

mkretz at Epsilon3% lshal -l -u usb_device_13b2_8_noserial_if0_alsa_playback_0
udi 
= '/org/freedesktop/Hal/devices/usb_device_13b2_8_noserial_if0_alsa_playback_0'
  info.udi 
= '/org/freedesktop/Hal/devices/usb_device_13b2_8_noserial_if0_alsa_playback_0'  
(string)
  linux.device_file = '/dev/snd/pcmC2D0p'  (string)
  linux.subsystem = 'sound'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  info.product = 'USB Audio ALSA Playback Device'  (string)
  alsa.type = 'playback'  (string)
  alsa.device_id = 'USB Audio'  (string)
  alsa.name = 'Alesis io|2'  (string)
  alsa.card_id = 'io2'  (string)
  alsa.device = 0  (0x0)  (int)
  alsa.card = 2  (0x2)  (int)
  alsa.physical_device 
= '/org/freedesktop/Hal/devices/usb_device_13b2_8_noserial_if0'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_13b2_8_noserial_if0'  
(string)
  alsa.device_file = '/dev/snd/pcmC2D0p'  (string)
  info.capabilities = {'alsa'} (string list)
  info.category = 'alsa'  (string)
  linux.sysfs_path = '/sys/class/sound/pcmC2D0p'  (string)

mkretz at Epsilon3% lshal -l -u usb_device_d8c_c_noserial_if0_alsa_playback_0
udi 
= '/org/freedesktop/Hal/devices/usb_device_d8c_c_noserial_if0_alsa_playback_0'
  info.udi 
= '/org/freedesktop/Hal/devices/usb_device_d8c_c_noserial_if0_alsa_playback_0'  
(string)
  linux.device_file = '/dev/snd/pcmC1D0p'  (string)
  linux.subsystem = 'sound'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  info.product = 'USB Audio ALSA Playback Device'  (string)
  alsa.type = 'playback'  (string)
  alsa.device_id = 'USB Audio'  (string)
  alsa.name = 'C-Media USB Headphone Set  '  (string)
  alsa.card_id = 'default'  (string)
  alsa.device = 0  (0x0)  (int)
  alsa.card = 1  (0x1)  (int)
  alsa.physical_device 
= '/org/freedesktop/Hal/devices/usb_device_d8c_c_noserial_if0'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_d8c_c_noserial_if0'  
(string)
  alsa.device_file = '/dev/snd/pcmC1D0p'  (string)
  info.capabilities = {'alsa'} (string list)
  info.category = 'alsa'  (string)
  linux.sysfs_path = '/sys/class/sound/pcmC1D0p'  (string)


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.

	Matthias

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20070109/bb5e66a0/attachment.pgp


More information about the hal mailing list