rawmidi virtual and long sysexes
Hi alsa-devel,
Recently I noticed this problem and fixed it in the client consuming sequencer events:
https://github.com/munt/munt/commit/0ea0846d0849872acf4384bdf5edeff026d12f42
Basically, the rawmidi virtual plugin enforces a 256-byte limit on events, and emits multiple events if e.g. a >256 byte sysex is encountered.
This does not seem to be documented behavior for snd_seq_event_input(), nor is the fixed limit described anywhere.
Would it be better if the maximum event size could be configured through params? That would avoid needing this clumsy workaround by sequencer clients. In any case, it seems that the documentation should be updated to reflect the need to receive multiple sequencer events to complete a sysex if EOX is not located in the first.
Please cc me as I'm not subscribed.
Signature · 1 line
Ryan C. Underwood, <[email protected]>
Quoted 3 lines · Ryan C. Underwood
Basically, the rawmidi virtual plugin enforces a 256-byte limit on events, and emits multiple events if e.g. a >256 byte sysex is encountered.
All sequencer clients have such a limit.
Quoted 2 lines
This does not seem to be documented behavior for
snd_seq_event_input(), nor is the fixed limit described anywhere.
Yes, the documentation is lacking.
Quoted 3 lines
Would it be better if the maximum event size could be configured through params? That would avoid needing this clumsy workaround by sequencer clients.
Handling split messages cannot be avoided; the API is not capable of sending arbitrarily large messages.
Regards,
Clemens
Quoted 6 lines · Clemens Ladisch
Quoted 3 lines · Ryan C. Underwood
Basically, the rawmidi virtual plugin enforces a 256-byte limit on events, and emits multiple events if e.g. a >256 byte sysex is encountered.
All sequencer clients have such a limit.
I was not objecting to a limit. I was questioning the utility of a _hard-coded_ limit.
Quoted 4 lines
Quoted 2 lines
This does not seem to be documented behavior for
snd_seq_event_input(), nor is the fixed limit described anywhere.Yes, the documentation is lacking.
What's the best way to submit a documentation change, patch the docs embedded in the code and mail that here?
Quoted 6 lines
Quoted 3 lines
Would it be better if the maximum event size could be configured through params? That would avoid needing this clumsy workaround by sequencer clients.
Handling split messages cannot be avoided; the API is not capable of sending arbitrarily large messages.
So, the client writing to rawmidi has local knowledge about the largest sysex he will generate. I only propose that alsa-lib be willing to accept this local knowledge over its own hard-coded default when sizing the event buffer. (For example, the device buffer size is configurable by the sequencer client.)
Of course, I won't bother if such a patch would be rejected, and will instead change the documentation.
Signature · 1 line
Ryan C. Underwood, <[email protected]>
Quoted 5 lines · Clemens Ladisch
Quoted 5 lines
Quoted 3 lines · Ryan C. Underwood
Basically, the rawmidi virtual plugin enforces a 256-byte limit on events, and emits multiple events if e.g. a >256 byte sysex is encountered.
All sequencer clients have such a limit.
Clemens, could you please clarify what did you mean in this message:
http://mailman.alsa-project.org/pipermail/alsa-devel/2015-March/088852.html
Didn't you mean the limit is 4096?
Quoted 2 lines
Handling split messages cannot be avoided; the API is not capable of sending arbitrarily large messages.
We are having this problem with munt, and for munt the largest sysex it can parse, is AFAIK around 300 bytes. It doesn't need the arbitrary large messages, because they are illegal for it. It should better have them dropped entirely. IMHO it would be nice to have the default buffer size large anough to avoid the fragmentation for all practical cases, leaving the fragmentation capability only for the pathological/ theoretical cases.
4096 is enough for this. 1024 is enough. 256 is obviously not. So IMHO it would be nice to just enlarge the default and save people from the troubles they actually really do not need to take. I mean, even the 1-byte buffer will work, but is it sane? pipes etc have >=4096 bytes AFAIK, so it is obviously not a problem for kernel to allow just that. So the question is very simple: why not?