diff options
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r-- | sound/usb/usbaudio.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 039f27dc1f08..45157d3cf789 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -773,6 +773,31 @@ static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sl | |||
773 | } | 773 | } |
774 | 774 | ||
775 | 775 | ||
776 | static const char *usb_error_string(int err) | ||
777 | { | ||
778 | switch (err) { | ||
779 | case -ENODEV: | ||
780 | return "no device"; | ||
781 | case -ENOENT: | ||
782 | return "endpoint not enabled"; | ||
783 | case -EPIPE: | ||
784 | return "endpoint stalled"; | ||
785 | case -ENOSPC: | ||
786 | return "not enough bandwidth"; | ||
787 | case -ESHUTDOWN: | ||
788 | return "device disabled"; | ||
789 | case -EHOSTUNREACH: | ||
790 | return "device suspended"; | ||
791 | case -EINVAL: | ||
792 | case -EAGAIN: | ||
793 | case -EFBIG: | ||
794 | case -EMSGSIZE: | ||
795 | return "internal error"; | ||
796 | default: | ||
797 | return "unknown error"; | ||
798 | } | ||
799 | } | ||
800 | |||
776 | /* | 801 | /* |
777 | * set up and start data/sync urbs | 802 | * set up and start data/sync urbs |
778 | */ | 803 | */ |
@@ -805,16 +830,22 @@ static int start_urbs(struct snd_usb_substream *subs, struct snd_pcm_runtime *ru | |||
805 | subs->unlink_mask = 0; | 830 | subs->unlink_mask = 0; |
806 | subs->running = 1; | 831 | subs->running = 1; |
807 | for (i = 0; i < subs->nurbs; i++) { | 832 | for (i = 0; i < subs->nurbs; i++) { |
808 | if ((err = usb_submit_urb(subs->dataurb[i].urb, GFP_ATOMIC)) < 0) { | 833 | err = usb_submit_urb(subs->dataurb[i].urb, GFP_ATOMIC); |
809 | snd_printk(KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); | 834 | if (err < 0) { |
835 | snd_printk(KERN_ERR "cannot submit datapipe " | ||
836 | "for urb %d, error %d: %s\n", | ||
837 | i, err, usb_error_string(err)); | ||
810 | goto __error; | 838 | goto __error; |
811 | } | 839 | } |
812 | set_bit(i, &subs->active_mask); | 840 | set_bit(i, &subs->active_mask); |
813 | } | 841 | } |
814 | if (subs->syncpipe) { | 842 | if (subs->syncpipe) { |
815 | for (i = 0; i < SYNC_URBS; i++) { | 843 | for (i = 0; i < SYNC_URBS; i++) { |
816 | if ((err = usb_submit_urb(subs->syncurb[i].urb, GFP_ATOMIC)) < 0) { | 844 | err = usb_submit_urb(subs->syncurb[i].urb, GFP_ATOMIC); |
817 | snd_printk(KERN_ERR "cannot submit syncpipe for urb %d, err = %d\n", i, err); | 845 | if (err < 0) { |
846 | snd_printk(KERN_ERR "cannot submit syncpipe " | ||
847 | "for urb %d, error %d: %s\n", | ||
848 | i, err, usb_error_string(err)); | ||
818 | goto __error; | 849 | goto __error; |
819 | } | 850 | } |
820 | set_bit(i + 16, &subs->active_mask); | 851 | set_bit(i + 16, &subs->active_mask); |