Lines 1-12
Link Here
|
1 |
--- src/modules/module-detect.c.orig 2016-05-10 12:28:04 UTC |
1 |
--- src/modules/module-detect.c.orig 2016-05-10 12:28:04 UTC |
2 |
+++ src/modules/module-detect.c |
2 |
+++ src/modules/module-detect.c |
3 |
@@ -160,8 +160,7 @@ static int detect_oss(pa_core *c, int ju |
3 |
@@ -160,11 +160,45 @@ static int detect_oss(pa_core *c, int ju |
4 |
continue; |
4 |
continue; |
5 |
|
5 |
|
6 |
} else if (sscanf(line, "pcm%u: ", &device) == 1) { |
6 |
} else if (sscanf(line, "pcm%u: ", &device) == 1) { |
7 |
- /* FreeBSD support, the devices are named /dev/dsp0.0, dsp0.1 and so on */ |
7 |
- /* FreeBSD support, the devices are named /dev/dsp0.0, dsp0.1 and so on */ |
8 |
- pa_snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device); |
8 |
- pa_snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device); |
9 |
+ pa_snprintf(args, sizeof(args), "device=/dev/dsp%u", device); |
9 |
+ pa_snprintf(args, sizeof(args), "device=/dev/dsp%u", device); |
|
|
10 |
+ pa_module *m = pa_module_load(c, "module-oss", args); |
10 |
|
11 |
|
11 |
if (!pa_module_load(c, "module-oss", args)) |
12 |
- if (!pa_module_load(c, "module-oss", args)) |
|
|
13 |
+ if (!m) |
14 |
+ continue; |
15 |
+ |
16 |
+ if (!pa_endswith(line, "default")) |
17 |
+ continue; |
18 |
+ |
19 |
+ const char *p = strrchr(line, '>'); |
20 |
+ |
21 |
+ if (!p) |
12 |
continue; |
22 |
continue; |
|
|
23 |
+ |
24 |
+ if (!c->default_sink && strstr(p, "play")) { |
25 |
+ uint32_t idx = PA_IDXSET_INVALID; |
26 |
+ pa_sink *s; |
27 |
+ PA_IDXSET_FOREACH(s, c->sinks, idx) { |
28 |
+ if (s->module == m) { |
29 |
+ if (!pa_namereg_set_default_sink(c, s)) |
30 |
+ pa_log_error("failed to set default sink for device: /dev/dsp%u", device); |
31 |
+ |
32 |
+ break; |
33 |
+ } |
34 |
+ } |
35 |
+ } |
36 |
+ |
37 |
+ if (!c->default_source && strstr(p, "rec")) { |
38 |
+ uint32_t idx = PA_IDXSET_INVALID; |
39 |
+ pa_source *s; |
40 |
+ PA_IDXSET_FOREACH(s, c->sources, idx) { |
41 |
+ if (s->module == m) { |
42 |
+ if (!pa_namereg_set_default_source(c, s)) |
43 |
+ pa_log_error("failed to set default source for device: /dev/dsp%u", device); |
44 |
+ |
45 |
+ break; |
46 |
+ } |
47 |
+ } |
48 |
+ } |
49 |
} |
50 |
|
51 |
n++; |