[alsa-devel] [PATCH 2/2] ALSA: hdspm - Provide unique driver id based on card serial

Adrian Knoth adi at drcomp.erfurt.thur.de
Wed Jan 4 14:31:17 CET 2012


Before, /proc/asound looked like this:

 2 [Default        ]: HDSPM - RME RayDAT_f1cd85
                      RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18

In case of a second HDSPM card, its name would be Default_1. This is
cumbersome, because the order of the cards isn't stable across reboots.

To help userspace tools referring to the correct card, this commit
provides a unique id for each card:

 2 [HDSPM_f1cd85   ]: HDSPM - RME RayDAT_f1cd85
                      RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18

In this example, userspace (configuration files) would then use
hw:HDSPM_f1cd85 to choose the right card.

The serial is masked to 24bits, so this string is always shorter than
sixteen chars.

Signed-off-by: Adrian Knoth <adi at drcomp.erfurt.thur.de>

diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 1609253..a3121c9 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6872,6 +6872,7 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
 		sprintf(card->shortname, "%s_%x",
 			hdspm->card_name,
 			hdspm->serial);
+		sprintf(card->id, "HDSPM_%x", hdspm->serial);
 		sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d",
 			hdspm->card_name,
 			hdspm->serial,
-- 
1.7.7.3



More information about the Alsa-devel mailing list