Update of /cvsroot/alsa/alsa-kernel/usb
In directory usw-pr-cvs1:/tmp/cvs-serv18963
Modified Files:
usbmixer.c
Log Message:
- fixed the size argument of strncpy.
- changed from printk to printd for some debug messages.
- print the unit id and the control value in debug messages.
- added missing line-feeds in strings.
Index: usbmixer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbmixer.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- usbmixer.c 11 Oct 2002 13:41:27 -0000 1.7
+++ usbmixer.c 11 Oct 2002 16:20:21 -0000 1.8
@@ -159,7 +159,7 @@
if (p->id == unitid &&
(! control || ! p->control || control == p->control)) {
buflen--;
- strncpy(buf, p->name, buflen - 1);
+ strncpy(buf, p->name, buflen);
buf[buflen] = 0;
return strlen(buf);
}
@@ -357,7 +357,7 @@
while (snd_ctl_find_id(card, &kctl->id))
kctl->id.index++;
if ((err = snd_ctl_add(card, kctl)) < 0) {
- snd_printk(KERN_ERR "cannot add control\n");
+ snd_printd(KERN_ERR "cannot add control (err = %d)\n", err);
snd_ctl_free_one(kctl);
}
return err;
@@ -577,7 +577,7 @@
}
if (get_ctl_value(cval, GET_MAX, (cval->control << 8) |
minchn, &cval->max) < 0 ||
get_ctl_value(cval, GET_MIN, (cval->control << 8) |
minchn, &cval->min) < 0) {
- snd_printk(KERN_ERR "%d:%d: cannot get min/max values
for control %d\n", cval->id, cval->ctrlif, cval->control);
+ snd_printd(KERN_ERR "%d:%d: cannot get min/max values
+for control %d (id %d)\n", cval->id, cval->ctrlif, cval->control, cval->id);
return -EINVAL;
}
cval->initialized = 1;
@@ -600,7 +600,7 @@
if (cval->cmask & (1 << c)) {
err = get_cur_mix_value(cval, c + 1, &val);
if (err < 0) {
- printk("cannot get current value for control
%d ch %d: err = %d\n", cval->control, c + 1, err);
+ snd_printd(KERN_ERR "cannot get current value
+for control %d ch %d: err = %d\n", cval->control, c + 1, err);
return err;
}
val = get_relative_value(cval, val);
@@ -612,7 +612,7 @@
/* master channel */
err = get_cur_mix_value(cval, 0, &val);
if (err < 0) {
- printk("cannot get current value for control %d master ch: err
= %d\n", cval->control, err);
+ snd_printd(KERN_ERR "cannot get current value for control %d
+master ch: err = %d\n", cval->control, err);
return err;
}
val = get_relative_value(cval, val);
@@ -691,7 +691,7 @@
cval = snd_magic_kcalloc(usb_mixer_elem_info_t, 0, GFP_KERNEL);
if (! cval) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
return;
}
cval->chip = state->chip;
@@ -721,14 +721,14 @@
} else {
if (get_ctl_value(cval, GET_MAX, (cval->control << 8) | minchn,
&cval->max) < 0 ||
get_ctl_value(cval, GET_MIN, (cval->control << 8) | minchn,
&cval->min) < 0)
- snd_printk(KERN_ERR "%d:%d: cannot get min/max values for
control %d\n", cval->id, cval->ctrlif, control);
+ snd_printd(KERN_ERR "%d:%d: cannot get min/max values for
+control %d (id %d)\n", cval->id, cval->ctrlif, control, unitid);
else
cval->initialized = 1;
}
kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
if (! kctl) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
snd_magic_kfree(cval);
return;
}
@@ -886,13 +886,13 @@
/* get min/max values */
if (get_ctl_value(cval, GET_MAX, (cval->control << 8) | minchn, &cval->max) <
0 ||
get_ctl_value(cval, GET_MIN, (cval->control << 8) | minchn, &cval->min) <
0)
- snd_printk(KERN_ERR "cannot get min/max values for mixer\n");
+ snd_printd(KERN_ERR "cannot get min/max values for mixer (id %d)\n",
+unitid);
else
cval->initialized = 1;
kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
if (! kctl) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
snd_magic_kfree(cval);
return;
}
@@ -1063,7 +1063,7 @@
};
if (dsc[0] < 13 || dsc[0] < 13 + num_ins || dsc[0] < num_ins + dsc[11 +
num_ins]) {
- snd_printk(KERN_ERR "invalid %s descriptor %d\n", name, unitid);
+ snd_printk(KERN_ERR "invalid %s descriptor (id %d)\n", name, unitid);
return -EINVAL;
}
@@ -1088,7 +1088,7 @@
continue;
cval = snd_magic_kcalloc(usb_mixer_elem_info_t, 0, GFP_KERNEL);
if (! cval) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
return -ENOMEM;
}
cval->chip = state->chip;
@@ -1101,15 +1101,15 @@
/* get min/max values */
if (get_ctl_value(cval, GET_MAX, cval->control, &cval->max) < 0 ||
get_ctl_value(cval, GET_MIN, cval->control, &cval->min) < 0)
- snd_printk(KERN_ERR "cannot get min/max values for proc/ext
unit\n");
+ snd_printd(KERN_ERR "cannot get min/max values for proc/ext
+control=%d, id=%d\n", cval->control, unitid);
else if (cval->max <= cval->min)
- snd_printk(KERN_ERR "invalid min/max values (%d/%d) for
proc/ext unit %d\n", cval->min, cval->max, unitid);
+ snd_printd(KERN_ERR "invalid min/max values (%d/%d) for
+proc/ext unit control=%d, id=%d\n", cval->min, cval->max, cval->control, unitid);
else
cval->initialized = 1;
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
if (! kctl) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
snd_magic_kfree(cval);
return -ENOMEM;
}
@@ -1263,7 +1263,7 @@
cval = snd_magic_kcalloc(usb_mixer_elem_info_t, 0, GFP_KERNEL);
if (! cval) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
return -ENOMEM;
}
cval->chip = state->chip;
@@ -1302,7 +1302,7 @@
kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval);
if (! kctl) {
- snd_printk(KERN_ERR "cannot malloc kcontrol");
+ snd_printk(KERN_ERR "cannot malloc kcontrol\n");
snd_magic_kfree(cval);
return -ENOMEM;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog