1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <pthread.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7
8 #include "devices.h"
9 /*
10 * default devices names
11 */
12 #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
13 struct ng_device_config ng_dev = {
14 .video = "/dev/bktr0",
15 .driver = "bktr",
16 .radio = NULL,
17 .vbi = "/dev/vbi0",
18 .dsp = "/dev/dsp",
19 .mixer = "/dev/mixer",
20 .video_scan = {
21 "/dev/bktr0",
22 "/dev/bktr1",
23 "/dev/cxm0",
24 "/dev/cxm1",
25 NULL
26 },
27 .mixer_scan = {
28 "/dev/mixer",
29 "/dev/mixer1",
30 "/dev/mixer2",
31 "/dev/mixer3",
32 NULL
33 }
34 };
35 #endif
36 #if defined(__linux__)
37 struct ng_device_config ng_dev = {
38 .video = "/dev/video0",
39 .driver = "libv4l",
40 .radio = "/dev/radio0",
41 .vbi = "/dev/vbi0",
42 .dsp = "/dev/dsp",
43 .mixer = "/dev/mixer",
44 .video_scan = {
45 "/dev/video0",
46 "/dev/video1",
47 "/dev/video2",
48 "/dev/video3",
49 NULL
50 },
51 .mixer_scan = {
52 "/dev/mixer",
53 "/dev/mixer1",
54 "/dev/mixer2",
55 "/dev/mixer3",
56 NULL
57 }
58 };
59
60 struct ng_device_config ng_dev_devfs = {
61 .video = "/dev/v4l/video0",
62 .driver = "libv4l",
63 .radio = "/dev/v4l/radio0",
64 .vbi = "/dev/v4l/vbi0",
65 .dsp = "/dev/sound/dsp",
66 .mixer = "/dev/sound/mixer",
67 .video_scan = {
68 "/dev/v4l/video0",
69 "/dev/v4l/video1",
70 "/dev/v4l/video2",
71 "/dev/v4l/video3",
72 NULL
73 },
74 .mixer_scan = {
75 "/dev/sound/mixer",
76 "/dev/sound/mixer1",
77 "/dev/sound/mixer2",
78 "/dev/sound/mixer3",
79 NULL
80 }
81 };
82 #endif
83
84 void
ng_device_init(void)85 ng_device_init(void)
86 {
87 #if defined(__linux__)
88 struct stat st;
89
90 if (-1 == lstat("/dev/.devfsd",&st))
91 return;
92 if (!S_ISCHR(st.st_mode))
93 return;
94 ng_dev = ng_dev_devfs;
95 #endif
96 }
97