Commit graph

5 commits

Author SHA1 Message Date
Takashi Iwai
4eecae44a5 ALSA: ump: Correct wrong byte size at converting a UMP System message
A wrong size for UMP_SYSTEM_STATUS_MIDI_TIME_CODE and case
UMP_SYSTEM_STATUS_SONG_SELECT was reported at converting to the legacy
MIDI 1.0 stream.  This patch corrects the value.

Fixes: 0b5288f5fe ("ALSA: ump: Add legacy raw MIDI support")
Link: https://lore.kernel.org/r/20230628094352.15754-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-28 11:44:30 +02:00
Takashi Iwai
33cd763078 ALSA: ump: Export MIDI1 / UMP conversion helpers
Yet more preliminary work for the upcoming USB gadget support.

Now export the helpers to convert between legacy MIDI1 and UMP data
for handling the MIDI 1.0 USB interface.  The header file is moved to
include/sound.

The API functions are slightly changed, so that they can be used
without the direct access to snd_ump object.  The allocation is done
in ump.c itself as it's a simple kcalloc().

Link: https://lore.kernel.org/r/20230623075530.10976-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-23 09:56:11 +02:00
Takashi Iwai
77700b81bd ALSA: ump: Fix parsing of 0xFx command
The MIDI 1.0 parser retrieved the 0xFx command with a wrong bit shift,
resulting in the bogus type.  Fix the bit shift size.

Fixes: 0b5288f5fe ("ALSA: ump: Add legacy raw MIDI support")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/0fbc0b27-54b8-4cda-800e-37e7a03fed39@kili.mountain
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20230525083124.15277-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-25 10:32:59 +02:00
Takashi Iwai
ab2335daa6 ALSA: ump: Drop redundant check of note-on with zero velocity
The check of a note-on event with zero velocity is done twice, and the
latter one is superfluous.  Let's drop it.

Fixes: 0b5288f5fe ("ALSA: ump: Add legacy raw MIDI support")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/4683198a-84f6-4238-9e87-c70667d84523@kili.mountain
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20230525083124.15277-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-25 10:32:58 +02:00
Takashi Iwai
0b5288f5fe ALSA: ump: Add legacy raw MIDI support
This patch extends the UMP core code to support the legacy MIDI 1.0
rawmidi devices.  When the new kconfig CONFIG_SND_UMP_LEGACY_RAWMIDI
is set, the UMP core allows to attach an additional rawmidi device for
each UMP Endpoint.  The rawmidi device contains 16 substreams where
each substream corresponds to a UMP Group belonging to the EP.  The
device reads/writes the legacy MIDI 1.0 byte streams and translates
from/to UMP packets.

The legacy rawmidi devices are exclusive with the UMP rawmidi devices,
hence both of them can't be opened at the same time unless the UMP
rawmidi is opened in APPEND mode.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-23 12:11:09 +02:00