[PATCH] add soundcard device and fix device_file handling
Danny Kukawka
danny.kukawka at web.de
Tue Mar 20 03:01:51 PDT 2007
On Dienstag, 20. März 2007, David Zeuthen wrote:
> On Mon, 2007-03-19 at 15:41 +0100, Danny Kukawka wrote:
> > Hi,
> >
> > this patch fixes these issues:
> > * change checks for empty device file path from 'device_file == NULL'
> > to 'device_file[0] == '\0'' since the device_file path is currently
> > never NULL but '\0' if empty/unset.
>
> Should probably stil check for device_file != NULL before looking at the
> first character...
IMO this is not needed because the coldplug code already do this:
no_node:
if (hotplug_event->sysfs.device_file[0] == '\0')
HAL_INFO (("new event (no dev node) '%s'", sysfs_path));
But I can add this really paranoid check.
> > * Add the sound card device to HAL (e.g. /sys/devices/pci*/*/card0) to
> > represent the correct sysfs structure. All alsa and oss devices are
> > now childs of the releated sound card device.
>
> Not on my box... does this require a new kernel / ALSA version or some
> special configuration? What's the point here btw and what's with the new
> sound.* properties? Perhaps explaining a bit more what you want to
> change, how it's going to look (lshal snippts) and why would be a good
> starting point... Thanks.
Is there no /sys/devices/pci*/*/card0 device on your machine? What print
'ls -lha /sys/class/sound/' on your machine? IMO this should be part of the
kernel with the new sysfs structure. IIRC it was not part of 2.6.18 but in
2.6.20 on my machines. At least it break nothing on older kernel versions.
The (finally, if we depend on 2.6.20) goal is to add all card related information
to the soundcard itself and not again and again to each single sound device
(as e.g. alsa/oss.card and alsa/oss.card_id). Btw this would also reflect the
real sysfs structure in the future.
At the moment the patch provide this (only a part of lshal on my machine):
------------------------------------------------------------------------------
udi = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0'
info.capabilities = {'sound'} (string list)
info.category = 'sound' (string)
info.parent = '/org/freedesktop/Hal/devices/pci_8086_24c5' (string)
info.product = 'Intel 82801DB-ICH4 with ALC202 Sound Card' (string)
info.udi = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'sound' (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.5/card0' (string)
sound.card = 0 (0x0) (int)
sound.card_id = 'Intel 82801DB-ICH4 with ALC202' (string)
sound.originating_device = '/org/freedesktop/Hal/devices/pci_8086_24c5' (string)
sound.physical_device = '/org/freedesktop/Hal/devices/pci_8086_24c5' (string)
udi = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0_alsa_playback_4'
alsa.card = 0 (0x0) (int)
alsa.card_id = 'Intel 82801DB-ICH4 with ALC202' (string)
alsa.device = 4 (0x4) (int)
alsa.device_file = '/dev/snd/pcmC0D4p' (string)
alsa.device_id = 'Intel 82801DB-ICH4 - IEC958' (string)
alsa.originating_device = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0' (string)
alsa.pcm_class = 'generic' (string)
alsa.physical_device = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0' (string)
alsa.type = 'playback' (string)
info.callouts.add = {'hal-resmgr'} (string list)
info.callouts.remove = {'hal-resmgr'} (string list)
info.capabilities = {'alsa'} (string list)
info.category = 'alsa' (string)
info.interfaces = {'org.freedesktop.Hal.Device.resmgr'} (string list)
info.parent = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0' (string)
info.product = 'Intel 82801DB-ICH4 - IEC958 ALSA Playback Device' (string)
info.udi = '/org/freedesktop/Hal/devices/pci_8086_24c5_sound_card_0_alsa_playback_4' (string)
linux.device_file = '/dev/snd/pcmC0D4p' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'sound' (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.5/card0/pcmC0D4p' (string)
org.freedesktop.Hal.Device.resmgr.method_argnames = {'', ''} (string list)
org.freedesktop.Hal.Device.resmgr.method_execpaths = {'hal-resmgr-grant', 'hal-resmgr-revoke'} (string list)
org.freedesktop.Hal.Device.resmgr.method_names = {'Grant', 'Revoke'} (string list)
org.freedesktop.Hal.Device.resmgr.method_signatures = {'', ''} (string list)
resmgr.class = 'sound' (string)
resmgr.device = '/dev/snd/pcmC0D4p' (string)
------------------------------------------------------------------------------
IMO we should think about moving the alsa and oss namespace to the (new) sound
namespace as a subspace/class by changing all alsa.*/oss.* properties to
sound.alsa.*/sound.oss.* , but for the we need to depend on >= 2.6.20
Danny
More information about the hal
mailing list