]>
Commit | Line | Data |
---|---|---|
3782f0e3 JB |
1 | --- alsa-tools-1.0.12/sb16_csp/cspctl.c.orig 2006-08-22 20:25:53.000000000 +0200 |
2 | +++ alsa-tools-1.0.12/sb16_csp/cspctl.c 2006-08-26 16:04:02.621408500 +0200 | |
3 | @@ -42,7 +42,7 @@ | |
4 | ||
5 | int card = 0; | |
6 | ||
7 | -static void error(const char *fmt,...) | |
8 | +static void csp_error(const char *fmt,...) | |
9 | { | |
10 | va_list va; | |
11 | ||
12 | @@ -78,7 +78,7 @@ | |
13 | ||
14 | /* open CSP hwdep device */ | |
15 | if ((err = snd_hwdep_open(&handle, name, O_WRONLY)) < 0) { | |
16 | - error("CSP open (%i-%i): %s", idx, dev, snd_strerror(err)); | |
17 | + csp_error("CSP open (%i-%i): %s", idx, dev, snd_strerror(err)); | |
18 | exit(1); | |
19 | } | |
20 | ||
21 | @@ -91,21 +91,21 @@ | |
22 | } | |
23 | /* read microcode to buffer */ | |
24 | if (read(fd, µcode.data, sizeof(microcode.data)) < 0) { | |
25 | - error("%s: read error", filename); | |
26 | + csp_error("%s: read error", filename); | |
27 | exit(1); | |
28 | } | |
29 | close(fd); | |
30 | ||
31 | /* load microcode to CSP */ | |
32 | if (snd_hwdep_ioctl(handle, SNDRV_SB_CSP_IOCTL_LOAD_CODE, µcode) < 0) { | |
33 | - error("unable to load microcode"); | |
34 | + csp_error("unable to load microcode"); | |
35 | exit(1); | |
36 | } | |
37 | break; | |
38 | case COMMAND_UNLOAD: | |
39 | /* unload microcode from CSP */ | |
40 | if (snd_hwdep_ioctl(handle, SNDRV_SB_CSP_IOCTL_UNLOAD_CODE, NULL) < 0) { | |
41 | - error("unable to unload microcode"); | |
42 | + csp_error("unable to unload microcode"); | |
43 | exit(1); | |
44 | } | |
45 | } | |
46 | @@ -145,7 +145,7 @@ | |
47 | { | |
48 | card = snd_card_get_index(optarg); | |
49 | if (card < 0 || card > 31) { | |
50 | - error ("wrong -c argument '%s'\n", optarg); | |
51 | + csp_error ("wrong -c argument '%s'\n", optarg); | |
52 | return 1; | |
53 | } | |
54 | } | |
55 | @@ -153,14 +153,14 @@ | |
56 | case 'f': | |
57 | microcode.info.func_req = atoi(optarg); | |
58 | if ((microcode.info.func_req < 1) || (microcode.info.func_req > 4)) { | |
59 | - error("value %i for function number is invalid", | |
60 | + csp_error("value %i for function number is invalid", | |
61 | microcode.info.func_req); | |
62 | return 1; | |
63 | } | |
64 | break; | |
65 | case 'd': | |
66 | if (strlen(optarg) > 16) { | |
67 | - error("codec description '%s' too long", optarg); | |
68 | + csp_error("codec description '%s' too long", optarg); | |
69 | return 1; | |
70 | } | |
71 | strcpy(microcode.info.codec_name, optarg); | |
72 | @@ -170,7 +170,7 @@ | |
73 | } | |
74 | } | |
75 | if (optind >= argc) { | |
76 | - error("please specify command"); | |
77 | + csp_error("please specify command"); | |
78 | return 1; | |
79 | } | |
80 | if (!strcmp (argv[optind], "load")) { | |
81 | @@ -178,32 +178,32 @@ | |
82 | } else if (!strcmp (argv[optind], "unload")) { | |
83 | command = COMMAND_UNLOAD; | |
84 | } else { | |
85 | - error ("command should be either 'load' or 'unload'"); | |
86 | + csp_error ("command should be either 'load' or 'unload'"); | |
87 | return 1; | |
88 | } | |
89 | ||
90 | if ((command == COMMAND_LOAD) && (++optind >= argc)) { | |
91 | - error ("missing microcode filename"); | |
92 | + csp_error ("missing microcode filename"); | |
93 | return 1; | |
94 | } | |
95 | ||
96 | // Get control handle for selected card | |
97 | sprintf(card_id, "hw:%i", card); | |
98 | if ((err = snd_ctl_open(&ctl_handle, card_id, 0)) < 0) { | |
99 | - error("control open (%s): %s", card_id, snd_strerror(err)); | |
100 | + csp_error("control open (%s): %s", card_id, snd_strerror(err)); | |
101 | return 1; | |
102 | } | |
103 | ||
104 | // Read control hardware info from card | |
105 | if ((err = snd_ctl_card_info(ctl_handle, card_info)) < 0) { | |
106 | - error("control hardware info (%s): %s", card_id, snd_strerror(err)); | |
107 | + csp_error("control hardware info (%s): %s", card_id, snd_strerror(err)); | |
108 | exit(1); | |
109 | } | |
110 | ||
111 | // CSP chip is present only on SB16 and SB AWE cards | |
112 | if (strcmp(snd_ctl_card_info_get_driver(card_info), "SB16") != 0 && | |
113 | strcmp(snd_ctl_card_info_get_driver(card_info), "SB AWE") != 0) { | |
114 | - error("not a SB16 or SB AWE type card"); | |
115 | + csp_error("not a SB16 or SB AWE type card"); | |
116 | exit(1); | |
117 | } | |
118 | ||
119 | @@ -212,13 +212,13 @@ | |
120 | err = 1; | |
121 | while (1) { | |
122 | if (snd_ctl_hwdep_next_device(ctl_handle, &dev) < 0) | |
123 | - error("hwdep next device (%s): %s", card_id, snd_strerror(err)); | |
124 | + csp_error("hwdep next device (%s): %s", card_id, snd_strerror(err)); | |
125 | if (dev < 0) | |
126 | break; | |
127 | snd_hwdep_info_set_device(hwdep_info, dev); | |
128 | if (snd_ctl_hwdep_info(ctl_handle, hwdep_info) < 0) { | |
129 | if (err != -ENOENT) | |
130 | - error("control hwdep info (%s): %s", card_id, snd_strerror(err)); | |
131 | + csp_error("control hwdep info (%s): %s", card_id, snd_strerror(err)); | |
132 | continue; | |
133 | } | |
134 | if (snd_hwdep_info_get_iface(hwdep_info) == SND_HWDEP_IFACE_SB16CSP) { | |
135 | @@ -227,7 +227,7 @@ | |
136 | } | |
137 | } | |
138 | if (err) | |
139 | - error("no CSP device present"); | |
140 | + csp_error("no CSP device present"); | |
141 | ||
142 | snd_ctl_close(ctl_handle); | |
143 | return 0; |