Skip to contentSkip to conversation

Detect all audio cards in the system (not only card0)

PATCH Yaroslav Isakov 1 participant 1 message Feb 28, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20160225065811.GA4313@noemi

Yaroslav Isakov

author
#1 lore raw

Sorry for this, here it is

2016-02-25 9:58 GMT+03:00 Magnus Fromreide <magfr(a)lysator.liu.se>:

Quoted 21 lines · Yaroslav Isakov
Quoted 8 lines
 src/devices/alsa.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/devices/alsa.cpp +0 -0
index 425b58a..f7ba2b6 100644

src/devices/alsa.cpp static void create_all_alsa_callback(const char · line 164

Quoted 8 lines
src/devices/alsa.cpp +1 -1
@@ -158,11 +158,11 @@ static void create_all_alsa_callback(const char
 *d_name)
     if (strncmp(d_name, "hwC", 3) != 0)
         return;
 
-    snprintf(filename, sizeof(filename),
 "/sys/class/sound/card0/%s/power_on_acct", d_name);
+    snprintf(filename, sizeof(filename),
 "/sys/class/sound/%s/power_on_acct", d_name);

It looks like your mailer helpfully linewraps the patch. Could you please resend it as an attachment?

Quoted 2 lines

/MF

From 59dcfa3b9f4a72252b4d245a5b4af137cbe7dfa8 Mon Sep 17 00:00:00 2001
From: Yaroslav Isakov <[email protected]>
Date: Mon, 22 Feb 2016 17:11:11 +0300
Subject: [PATCH 1/2] Detect all audio cards in the system (not only card0)

---
 src/devices/alsa.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/devices/alsa.cpp +3 -3
index 425b58a..f7ba2b6 100644
@@ -158,11 +158,11 @@ static void create_all_alsa_callback(const char *d_name)
 	if (strncmp(d_name, "hwC", 3) != 0)
 		return;
 
-	snprintf(filename, sizeof(filename), "/sys/class/sound/card0/%s/power_on_acct", d_name);
+	snprintf(filename, sizeof(filename), "/sys/class/sound/%s/power_on_acct", d_name);
 	if (access(filename, R_OK) != 0)
 		return;
 
-	snprintf(filename, sizeof(filename), "/sys/class/sound/card0/%s", d_name);
+	snprintf(filename, sizeof(filename), "/sys/class/sound/%s", d_name);
 	bl = new class alsa(d_name, filename);
 	all_devices.push_back(bl);
 	register_parameter("alsa-codec-power", 0.5);
@@ -170,7 +170,7 @@ static void create_all_alsa_callback(const char *d_name)
 
 void create_all_alsa(void)
 {
-	process_directory("/sys/class/sound/card0/", create_all_alsa_callback);
+	process_directory("/sys/class/sound/", create_all_alsa_callback);
 }
 
 double alsa::power_usage(struct result_bundle *result, struct parameter_bundle *bundle)
Signature · 1 line
2.4.10