aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/seq
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-07-21 02:01:22 -0400
committerJaroslav Kysela <perex@suse.cz>2005-07-28 06:22:34 -0400
commitd06e4c4001cf26147a6af0718703368944f0df32 (patch)
tree292c421927434fab4a5e6017b6b842b633d6e51b /sound/core/seq
parent7858ffa062886706026cfff3ba80b8400b520501 (diff)
[ALSA] seq-midi - silently ignore non-MIDI events
ALSA sequencer When non-MIDI sequencer events are sent to a RawMIDI port, silently ignore them instead of returning a confusing error code which may upset the sequencer and abort the current write() to /dev/snd/seq. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core/seq')
-rw-r--r--sound/core/seq/seq_midi.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index 57be9155eb62..4374829ea770 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -134,7 +134,7 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
134 seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; 134 seq_midisynth_t *msynth = (seq_midisynth_t *) private_data;
135 unsigned char msg[10]; /* buffer for constructing midi messages */ 135 unsigned char msg[10]; /* buffer for constructing midi messages */
136 snd_rawmidi_substream_t *substream; 136 snd_rawmidi_substream_t *substream;
137 int res; 137 int len;
138 138
139 snd_assert(msynth != NULL, return -EINVAL); 139 snd_assert(msynth != NULL, return -EINVAL);
140 substream = msynth->output_rfile.output; 140 substream = msynth->output_rfile.output;
@@ -146,20 +146,16 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
146 snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); 146 snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags);
147 return 0; 147 return 0;
148 } 148 }
149 res = snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); 149 snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
150 snd_midi_event_reset_decode(msynth->parser); 150 snd_midi_event_reset_decode(msynth->parser);
151 if (res < 0)
152 return res;
153 } else { 151 } else {
154 if (msynth->parser == NULL) 152 if (msynth->parser == NULL)
155 return -EIO; 153 return -EIO;
156 res = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); 154 len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev);
157 if (res < 0) 155 if (len < 0)
158 return res; 156 return 0;
159 if ((res = dump_midi(substream, msg, res)) < 0) { 157 if (dump_midi(substream, msg, len) < 0)
160 snd_midi_event_reset_decode(msynth->parser); 158 snd_midi_event_reset_decode(msynth->parser);
161 return res;
162 }
163 } 159 }
164 return 0; 160 return 0;
165} 161}