@@ -37,6 +37,7 @@ static int process_legacy_output(struct snd_ump_endpoint *ump,
37
37
u32 * buffer , int count );
38
38
static void process_legacy_input (struct snd_ump_endpoint * ump , const u32 * src ,
39
39
int words );
40
+ static void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint * ump );
40
41
static void update_legacy_names (struct snd_ump_endpoint * ump );
41
42
#else
42
43
static 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,
48
49
const u32 * src , int words )
49
50
{
50
51
}
52
+ static inline void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint * ump )
53
+ {
54
+ }
51
55
static inline void update_legacy_names (struct snd_ump_endpoint * ump )
52
56
{
53
57
}
@@ -751,8 +755,16 @@ static void ump_set_rawmidi_name(struct snd_ump_endpoint *ump)
751
755
static int ump_handle_ep_name_msg (struct snd_ump_endpoint * ump ,
752
756
const union snd_ump_stream_msg * buf )
753
757
{
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 ;
756
768
}
757
769
758
770
/* 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)
1308
1320
update_legacy_substreams (ump , rmidi , SNDRV_RAWMIDI_STREAM_OUTPUT );
1309
1321
}
1310
1322
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
+
1311
1331
int snd_ump_attach_legacy_rawmidi (struct snd_ump_endpoint * ump ,
1312
1332
char * id , int device )
1313
1333
{
@@ -1338,12 +1358,11 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
1338
1358
if (output )
1339
1359
snd_rawmidi_set_ops (rmidi , SNDRV_RAWMIDI_STREAM_OUTPUT ,
1340
1360
& snd_ump_legacy_output_ops );
1341
- snprintf (rmidi -> name , sizeof (rmidi -> name ), "%.68s (MIDI 1.0)" ,
1342
- ump -> core .name );
1343
1361
rmidi -> info_flags = ump -> core .info_flags & ~SNDRV_RAWMIDI_INFO_UMP ;
1344
1362
rmidi -> ops = & snd_ump_legacy_ops ;
1345
1363
rmidi -> private_data = ump ;
1346
1364
ump -> legacy_rmidi = rmidi ;
1365
+ ump_legacy_set_rawmidi_name (ump );
1347
1366
update_legacy_names (ump );
1348
1367
1349
1368
rmidi -> tied_device = ump -> core .device ;
0 commit comments