@@ -37,6 +37,7 @@ static int process_legacy_output(struct snd_ump_endpoint *ump,
3737 u32 * buffer , int count );
3838static void process_legacy_input (struct snd_ump_endpoint * ump , const u32 * src ,
3939 int words );
40+ static void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint * ump );
4041static void update_legacy_names (struct snd_ump_endpoint * ump );
4142#else
4243static inline int process_legacy_output (struct snd_ump_endpoint * ump ,
@@ -48,6 +49,9 @@ static inline void process_legacy_input(struct snd_ump_endpoint *ump,
4849 const u32 * src , int words )
4950{
5051}
52+ static inline void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint * ump )
53+ {
54+ }
5155static inline void update_legacy_names (struct snd_ump_endpoint * ump )
5256{
5357}
@@ -751,8 +755,16 @@ static void ump_set_rawmidi_name(struct snd_ump_endpoint *ump)
751755static int ump_handle_ep_name_msg (struct snd_ump_endpoint * ump ,
752756 const union snd_ump_stream_msg * buf )
753757{
754- return ump_append_string (ump , ump -> info .name , sizeof (ump -> info .name ),
755- buf -> raw , 2 );
758+ int ret ;
759+
760+ ret = ump_append_string (ump , ump -> info .name , sizeof (ump -> info .name ),
761+ buf -> raw , 2 );
762+ if (ret && ump -> parsed ) {
763+ ump_set_rawmidi_name (ump );
764+ ump_legacy_set_rawmidi_name (ump );
765+ }
766+
767+ return ret ;
756768}
757769
758770/* handle EP product id stream message; update the UMP product_id string */
@@ -1308,6 +1320,14 @@ static void update_legacy_names(struct snd_ump_endpoint *ump)
13081320 update_legacy_substreams (ump , rmidi , SNDRV_RAWMIDI_STREAM_OUTPUT );
13091321}
13101322
1323+ static void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint * ump )
1324+ {
1325+ struct snd_rawmidi * rmidi = ump -> legacy_rmidi ;
1326+
1327+ snprintf (rmidi -> name , sizeof (rmidi -> name ), "%.68s (MIDI 1.0)" ,
1328+ ump -> core .name );
1329+ }
1330+
13111331int snd_ump_attach_legacy_rawmidi (struct snd_ump_endpoint * ump ,
13121332 char * id , int device )
13131333{
@@ -1338,12 +1358,11 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
13381358 if (output )
13391359 snd_rawmidi_set_ops (rmidi , SNDRV_RAWMIDI_STREAM_OUTPUT ,
13401360 & snd_ump_legacy_output_ops );
1341- snprintf (rmidi -> name , sizeof (rmidi -> name ), "%.68s (MIDI 1.0)" ,
1342- ump -> core .name );
13431361 rmidi -> info_flags = ump -> core .info_flags & ~SNDRV_RAWMIDI_INFO_UMP ;
13441362 rmidi -> ops = & snd_ump_legacy_ops ;
13451363 rmidi -> private_data = ump ;
13461364 ump -> legacy_rmidi = rmidi ;
1365+ ump_legacy_set_rawmidi_name (ump );
13471366 update_legacy_names (ump );
13481367
13491368 rmidi -> tied_device = ump -> core .device ;
0 commit comments