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
7 -static void error(const char *fmt,...)
8 +static void csp_error(const char *fmt,...)
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));
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);
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");
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");
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);
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);
66 if (strlen(optarg) > 16) {
67 - error("codec description '%s' too long", optarg);
68 + csp_error("codec description '%s' too long", optarg);
71 strcpy(microcode.info.codec_name, optarg);
76 - error("please specify command");
77 + csp_error("please specify command");
80 if (!strcmp (argv[optind], "load")) {
82 } else if (!strcmp (argv[optind], "unload")) {
83 command = COMMAND_UNLOAD;
85 - error ("command should be either 'load' or 'unload'");
86 + csp_error ("command should be either 'load' or 'unload'");
90 if ((command == COMMAND_LOAD) && (++optind >= argc)) {
91 - error ("missing microcode filename");
92 + csp_error ("missing microcode filename");
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));
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));
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");
119 @@ -212,13 +212,13 @@
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));
127 snd_hwdep_info_set_device(hwdep_info, dev);
128 if (snd_ctl_hwdep_info(ctl_handle, hwdep_info) < 0) {
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));
134 if (snd_hwdep_info_get_iface(hwdep_info) == SND_HWDEP_IFACE_SB16CSP) {
139 - error("no CSP device present");
140 + csp_error("no CSP device present");
142 snd_ctl_close(ctl_handle);