Add API helper functions for creating UMP Endpoint and Blocks
cover Add API helper functions for creating UMP Endpoint and Blocks
Hi,
this is a patch set to alsa-lib to add the new API functions for creating a virtual UMP Endpoint and UMP Blocks arbitrarily from a user-space, that is, to create a virtual UMP device.
An example program is included in test directory.
Takashi
===
Takashi Iwai (4):
ump: Add missing *_set variants for snd_ump_endpoint_info and
snd_ump_block_info
seq: Add API helper functions for creating UMP Endpoint and Blocks
test: Add an example program to create a virtual UMP Endpoint Add test/seq-ump-example to .gitignore
.gitignore | 1 + include/seqmid.h | 7 + include/ump.h | 36 ++++- src/rawmidi/ump.c | 304 +++++++++++++++++++++++++++++++++++++++-- src/seq/seq.c | 6 +- src/seq/seq_local.h | 4 + src/seq/seqmid.c | 249 +++++++++++++++++++++++++++++++++ test/Makefile.am | 3 +- test/seq-ump-example.c | 187 +++++++++++++++++++++++++ 9 files changed, 783 insertions(+), 14 deletions(-) create mode 100644 test/seq-ump-example.c
Signature · 1 line
2.43.0
PATCH 1/4 ump: Add missing *_set variants for snd_ump_endpoint_info and snd_ump_block_info
The API functions to fill the data on snd_ump_endpoint_info and snd_ump_block_info were missing. Let's add them.
They can be used to construct a virtual UMP endpoint and block.
--- include/ump.h | 30 ++++- src/rawmidi/ump.c | 304 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 322 insertions(+), 12 deletions(-)
include/ump.h +29 -1
@@ -77,6 +77,7 @@ size_t snd_ump_endpoint_info_sizeof(void);#define snd_ump_endpoint_info_alloca (ptr) __snd_alloca(ptr, snd_ump_endpoint_info)int snd_ump_endpoint_info_malloc (snd_ump_endpoint_info_t **info);void snd_ump_endpoint_info_free (snd_ump_endpoint_info_t *info); +void snd_ump_endpoint_info_clear (snd_ump_endpoint_info_t *info);void snd_ump_endpoint_info_copy (snd_ump_endpoint_info_t *dst,const snd_ump_endpoint_info_t *src);int snd_ump_endpoint_info_get_card (const snd_ump_endpoint_info_t *info);int snd_ump_endpoint_info_get_device (const snd_ump_endpoint_info_t *info);
@@ -93,6 +94,20 @@ const char *snd_ump_endpoint_info_get_name(const snd_ump_endpoint_info_t *info);const char *snd_ump_endpoint_info_get_product_id (const snd_ump_endpoint_info_t *info);int snd_ump_endpoint_info (snd_ump_t *ump,snd_ump_endpoint_info_t *info); +void snd_ump_endpoint_info_set_card (snd_ump_endpoint_info_t *info,unsigned int card); +void snd_ump_endpoint_info_set_device (snd_ump_endpoint_info_t *info,unsigned int device); +void snd_ump_endpoint_info_set_flags (snd_ump_endpoint_info_t *info,unsigned int flags); +void snd_ump_endpoint_info_set_protocol_caps (snd_ump_endpoint_info_t *info,unsigned int caps); +void snd_ump_endpoint_info_set_protocol (snd_ump_endpoint_info_t *info,unsigned int protocols); +void snd_ump_endpoint_info_set_num_blocks (snd_ump_endpoint_info_t *info,unsigned int num_blocks); +void snd_ump_endpoint_info_set_version (snd_ump_endpoint_info_t *info,unsigned int version); +void snd_ump_endpoint_info_set_manufacturer_id (snd_ump_endpoint_info_t *info,unsigned int id); +void snd_ump_endpoint_info_set_family_id (snd_ump_endpoint_info_t *info,unsigned int id); +void snd_ump_endpoint_info_set_model_id (snd_ump_endpoint_info_t *info,unsigned int id); +void snd_ump_endpoint_info_set_sw_revision (snd_ump_endpoint_info_t *info,const unsigned char *id); +void snd_ump_endpoint_info_set_name (snd_ump_endpoint_info_t *info,const char *name); +void snd_ump_endpoint_info_set_product_id (snd_ump_endpoint_info_t *info,const char *id); +/** Bit flag for MIDI 1.0 port w/o restrict in UMP Block info flags */ #define SND_UMP_BLOCK_IS_MIDI1 (1U << 0)/** Bit flag for 31.25Kbps B/W MIDI1 port in UMP Block info flags */
@@ -118,11 +133,11 @@ size_t snd_ump_block_info_sizeof(void);#define snd_ump_block_info_alloca (ptr) __snd_alloca(ptr, snd_ump_block_info)int snd_ump_block_info_malloc (snd_ump_block_info_t **info);void snd_ump_block_info_free (snd_ump_block_info_t *info); +void snd_ump_block_info_clear (snd_ump_block_info_t *info);void snd_ump_block_info_copy (snd_ump_block_info_t *dst,const snd_ump_block_info_t *src);int snd_ump_block_info_get_card (const snd_ump_block_info_t *info);int snd_ump_block_info_get_device (const snd_ump_block_info_t *info);unsigned int snd_ump_block_info_get_block_id (const snd_ump_block_info_t *info); -void snd_ump_block_info_set_block_id (snd_ump_block_info_t *info,unsigned int id);unsigned int snd_ump_block_info_get_active (const snd_ump_block_info_t *info);unsigned int snd_ump_block_info_get_flags (const snd_ump_block_info_t *info);unsigned int snd_ump_block_info_get_direction (const snd_ump_block_info_t *info);
@@ -134,6 +149,19 @@ unsigned int snd_ump_block_info_get_ui_hint(const snd_ump_block_info_t *info);const char *snd_ump_block_info_get_name (const snd_ump_block_info_t *info);int snd_ump_block_info (snd_ump_t *ump,snd_ump_block_info_t *info); +void snd_ump_block_info_set_card (snd_ump_block_info_t *info,unsigned int card); +void snd_ump_block_info_set_device (snd_ump_block_info_t *info,unsigned int device); +void snd_ump_block_info_set_block_id (snd_ump_block_info_t *info,unsigned int id); +void snd_ump_block_info_set_active (snd_ump_block_info_t *info,unsigned int active); +void snd_ump_block_info_set_flags (snd_ump_block_info_t *info,unsigned int flags); +void snd_ump_block_info_set_direction (snd_ump_block_info_t *info,unsigned int direction); +void snd_ump_block_info_set_first_group (snd_ump_block_info_t *info,unsigned int first_group); +void snd_ump_block_info_set_num_groups (snd_ump_block_info_t *info,unsigned int num_groups); +void snd_ump_block_info_set_midi_ci_version (snd_ump_block_info_t *info,unsigned int version); +void snd_ump_block_info_set_sysex8_streams (snd_ump_block_info_t *info,unsigned int streams); +void snd_ump_block_info_set_ui_hint (snd_ump_block_info_t *info,unsigned int hint); +void snd_ump_block_info_set_name (snd_ump_block_info_t *info,const char *name); + #ifdef __cplusplus }#endif
src/rawmidi/ump.c +293 -11
334 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 2/4 seq: Add API helper functions for creating UMP Endpoint and Blocks
In reply to Takashi IwaiFor making it easer for applications to create a virtual UMP Endpoint and UMP blocks, add two API helper functions.
snd_seq_create_ump_endpoint() creates (unsurprisingly) a UMP Endpoint, based on the given snd_ump_endpoint_info_t information. The number of (max) UMP groups belonging to this Endpoint has to be specified. This function sets up the Endpoint info on the sequencer client, and creates a MIDI 2.0 UMP port as well as UMP Group ports automatically. The name of the sequencer client is updated from the Endpoint name, too.
After creating a UMP Endpoint, create each UMP Block via snd_seq_create_ump_block() function with a snd_ump_block_info_t info. The associated groups for each block have to be specified there. The port names and capability bits are updated accordingly after setting each block information.
--- include/seqmid.h | 7 ++ include/ump.h | 6 ++ src/seq/seq.c | 6 +- src/seq/seq_local.h | 4 + src/seq/seqmid.c | 249 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 271 insertions(+), 1 deletion(-)
include/seqmid.h +7 -0
@@ -520,6 +520,13 @@ int snd_seq_reset_pool_input(snd_seq_t *seq); ((ev)->type =SND_SEQ_EVENT_SYSEX ,\snd_seq_ev_set_variable (ev, datalen, dataptr)) +/* Helper API functions for UMP endpoint and block creations */ +int snd_seq_create_ump_endpoint (snd_seq_t *seq, +const snd_ump_endpoint_info_t *info, +unsigned int num_groups); +int snd_seq_create_ump_block (snd_seq_t *seq,int blkid, +const snd_ump_block_info_t *info); +/** \} */ #ifdef __cplusplus
include/ump.h +6 -0
@@ -69,6 +69,9 @@ enum _snd_ump_direction {/** Bit flag for JRTS in Receive */ #define SND_UMP_EP_INFO_PROTO_JRTS_RX 0x0002 +/** Default version passed to UMP Endpoint info */ +#define SND_UMP_EP_INFO_DEFAULT_VERSION 0x0101 +size_t snd_ump_endpoint_info_sizeof (void );/** \hideinitializer * \brief allocate an invalid #snd_ump_endpoint_info_t using standard alloca
@@ -125,6 +128,9 @@ enum _snd_ump_block_ui_hint { SND_UMP_BLOCK_UI_HINT_BOTH = 0x03, }; +/** Default MIDI CI version passed to UMP Block info */ +#define SND_UMP_BLOCK_INFO_DEFAULT_MIDI_CI_VERSION 0x01 +size_t snd_ump_block_info_sizeof (void );/** \hideinitializer * \brief allocate an invalid #snd_ump_block_info_t using standard alloca
src/seq/seq.c +5 -1
@@ -1042,7 +1042,8 @@ int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,*/ int snd_seq_close (snd_seq_t *seq) { -int err; +int i, err; +assert (seq); err = seq->ops->close (seq);if (seq->dl_handle)
@@ -1051,6 +1052,9 @@ int snd_seq_close(snd_seq_t *seq)free (seq->ibuf);free (seq->tmpbuf);free (seq->name); +free (seq->ump_ep); +for (i =0 ; i <16 ; i++) +free (seq->ump_blks[i]);free (seq);return err; }
src/seq/seq_local.h +4 -0
@@ -94,6 +94,10 @@ struct _snd_seq {size_t tmpbufsize;/* size of errbuf */ size_t packet_size;/* input packet alignment size */ int midi_version;/* current protocol version */ + +unsigned int num_ump_groups;/* number of UMP groups */ +snd_ump_endpoint_info_t *ump_ep;/* optional UMP info */ +snd_ump_block_info_t *ump_blks[16 ];/* optional UMP block info */ };int snd_seq_hw_open (snd_seq_t **handle,const char *name,int streams,int mode);
src/seq/seqmid.c +249 -0
252 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH alsa-lib 2/4] seq: Add API helper functions for creating UMP Endpoint and Blocks
Quoted 19 lines · Takashi Iwai
For making it easer for applications to create a virtual UMP Endpoint and UMP blocks, add two API helper functions.
snd_seq_create_ump_endpoint()creates (unsurprisingly) a UMP Endpoint, based on the givensnd_ump_endpoint_info_tinformation. The number of (max) UMP groups belonging to this Endpoint has to be specified. This function sets up the Endpoint info on the sequencer client, and creates a MIDI 2.0 UMP port as well as UMP Group ports automatically. The name of the sequencer client is updated from the Endpoint name, too.After creating a UMP Endpoint, create each UMP Block via
snd_seq_create_ump_block()function with asnd_ump_block_info_tinfo. The associated groups for each block have to be specified there. The port names and capability bits are updated accordingly after setting each block information.Signed-off-by Takashi Iwai <[email protected]>---
...
src/seq/seqmid.c int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg) · line 674
Quoted 4 lines
src/seq/seqmid.c +4
-0+if (*blknames) { +strlcat (blknames,", " ,sizeof (blknames)); +strlcat (blknames, (const char *)bp->name, +sizeof (blknames));
FYI, this seems to introduce build problems on systems that do not have strlcpy:
During build:seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:33: warning: implicit declaration of function ‘strlcat’; did you mean ‘strncat’? [-Wimplicit-function-declaration]
672 | strlcat(blknames, ", ",
sizeof(blknames));
| ^~~~~~~
| strncatAnd then during linking:/usr/bin/ld: seq/.libs/libseq.a(seqmid.o): in function `update_group_ports':/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:672: undefined reference to strlcat' /usr/bin/ld: /home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:673: undefined reference to strlcat'
collect2: error: ld returned 1 exit status
Re: [PATCH alsa-lib 2/4] seq: Add API helper functions for creating UMP Endpoint and Blocks
Quoted 42 lines · Amadeusz Sławiński
Quoted 19 lines · Takashi Iwai
For making it easer for applications to create a virtual UMP Endpoint and UMP blocks, add two API helper functions.
snd_seq_create_ump_endpoint()creates (unsurprisingly) a UMP Endpoint, based on the givensnd_ump_endpoint_info_tinformation. The number of (max) UMP groups belonging to this Endpoint has to be specified. This function sets up the Endpoint info on the sequencer client, and creates a MIDI 2.0 UMP port as well as UMP Group ports automatically. The name of the sequencer client is updated from the Endpoint name, too.After creating a UMP Endpoint, create each UMP Block via
snd_seq_create_ump_block()function with asnd_ump_block_info_tinfo. The associated groups for each block have to be specified there. The port names and capability bits are updated accordingly after setting each block information.Signed-off-by Takashi Iwai <[email protected]>---
...
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (*blknames) { + strlcat(blknames, ", ", sizeof(blknames)); + strlcat(blknames, (const char *)bp->name, + sizeof(blknames));FYI, this seems to introduce build problems on systems that do not have strlcpy:
During build:
seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:33: warning: implicit declaration of function ‘strlcat’; did you mean ‘strncat’? [-Wimplicit-function-declaration]
672 | strlcat(blknames, ", ",
sizeof(blknames));| ^~~~~~~ | strncat
Quoted 7 lines
And then during linking:
/usr/bin/ld: seq/.libs/libseq.a(seqmid.o): in function `update_group_ports':/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:672: undefined reference to `strlcat'/usr/bin/ld:/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:673:
undefined reference to `strlcat'
collect2: error: ld returned 1 exit status
Thanks, I'll modify it to avoid strlcat() like below.
Takashi
-- 8< --
Subject: [PATCH] seq: Avoid strlcat()
strlcat() isn't available in every system, so better to avoid it. Rewrite the code without strlcat().
--- src/seq/seqmid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
src/seq/seqmid.c +6 -6
@@ -635,6 +635,7 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)char blknames[64 ];char name[64 ];unsigned int caps =0 ; +int len; blknames[0 ] =0 ;for (b =0 ; b < ep->num_blocks; b++) {
@@ -668,14 +669,13 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)if (!*bp->name)continue ; -if (*blknames) { -strlcat (blknames,", " ,sizeof (blknames)); -strlcat (blknames, (const char *)bp->name, -sizeof (blknames)); - }else { + len =strlen (blknames); +if (len) +snprintf (blknames + len,sizeof (blknames) - len, +", %s" , bp->name); +else snd_strlcpy (blknames, (const char *)bp->name,sizeof (blknames)); - } }if (!*blknames)
Signature · 1 line
2.43.0
Re: [PATCH alsa-lib 2/4] seq: Add API helper functions for creating UMP Endpoint and Blocks
Quoted 92 lines · Takashi Iwai
Quoted 42 lines · Amadeusz Sławiński
Quoted 19 lines · Takashi Iwai
For making it easer for applications to create a virtual UMP Endpoint and UMP blocks, add two API helper functions.
snd_seq_create_ump_endpoint()creates (unsurprisingly) a UMP Endpoint, based on the givensnd_ump_endpoint_info_tinformation. The number of (max) UMP groups belonging to this Endpoint has to be specified. This function sets up the Endpoint info on the sequencer client, and creates a MIDI 2.0 UMP port as well as UMP Group ports automatically. The name of the sequencer client is updated from the Endpoint name, too.After creating a UMP Endpoint, create each UMP Block via
snd_seq_create_ump_block()function with asnd_ump_block_info_tinfo. The associated groups for each block have to be specified there. The port names and capability bits are updated accordingly after setting each block information.Signed-off-by Takashi Iwai <[email protected]>---
...
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (*blknames) { + strlcat(blknames, ", ", sizeof(blknames)); + strlcat(blknames, (const char *)bp->name, + sizeof(blknames));FYI, this seems to introduce build problems on systems that do not have strlcpy:
During build:
seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:33: warning: implicit declaration of function ‘strlcat’; did you mean ‘strncat’? [-Wimplicit-function-declaration]
672 | strlcat(blknames, ", ",
sizeof(blknames));| ^~~~~~~ | strncatQuoted 7 lines
And then during linking:
/usr/bin/ld: seq/.libs/libseq.a(seqmid.o): in function `update_group_ports':/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:672: undefined reference to `strlcat'/usr/bin/ld:/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:673:
undefined reference to `strlcat'
collect2: error: ld returned 1 exit statusThanks, I'll modify it to avoid
strlcat()like below.Takashi
-- 8< --
Subject: [PATCH] seq: Avoidstrlcat()
strlcat()isn't available in every system, so better to avoid it. Rewrite the code withoutstrlcat().Fixes 6167b8ce3e80 ("seq: Add API helper functions for creating UMP Endpoint and Blocks")Signed-off-by Takashi Iwai <[email protected]>--- src/seq/seqmid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)src/seq/seqmid.c +2
-5@@ -635,6 +635,7 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)char blknames[64 ];char name[64 ];unsigned int caps =0 ; +int len; blknames[0 ] =0 ;for (b =0 ; b < ep->num_blocks; b++) {@@ -668,14 +669,13 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)if (!*bp->name)continue ; -if (*blknames) { -strlcat (blknames,", " ,sizeof (blknames)); -strlcat (blknames, (const char *)bp->name, -sizeof (blknames)); - }else { + len =strlen (blknames);
src/seq/seqmid.c static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep) · line 681
Quoted 10 lines
src/seq/seqmid.c +4
-1+if (len) +snprintf (blknames + len,sizeof (blknames) - len, +", %s" , bp->name); +else snd_strlcpy (blknames, (const char *)bp->name,sizeof (blknames)); - } }if (!*blknames)
Builds now, but still gives warning:
seqmid.c: In function ‘update_group_ports’:
seqmid.c:675:45: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 61 [-Wformat-truncation=]
675 | ", %s", bp->name);
| ^~
In file included from /usr/include/stdio.h:894,
from ../../include/local.h:28,
from seq_local.h:26,
from seqmid.c:23:In function ‘snprintf’,
inlined from ‘update_group_ports’ at seqmid.c:674:5:/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 3 and 130 bytes into a destination of size 63
71 | return __builtin___snprintf_chk (__s, __n,__USE_FORTIFY_LEVEL - 1,
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~Re: [PATCH alsa-lib 2/4] seq: Add API helper functions for creating UMP Endpoint and Blocks
Quoted 121 lines · Amadeusz Sławiński
Quoted 89 lines · Takashi Iwai
Quoted 42 lines · Amadeusz Sławiński
Quoted 19 lines · Takashi Iwai
For making it easer for applications to create a virtual UMP Endpoint and UMP blocks, add two API helper functions.
snd_seq_create_ump_endpoint()creates (unsurprisingly) a UMP Endpoint, based on the givensnd_ump_endpoint_info_tinformation. The number of (max) UMP groups belonging to this Endpoint has to be specified. This function sets up the Endpoint info on the sequencer client, and creates a MIDI 2.0 UMP port as well as UMP Group ports automatically. The name of the sequencer client is updated from the Endpoint name, too.After creating a UMP Endpoint, create each UMP Block via
snd_seq_create_ump_block()function with asnd_ump_block_info_tinfo. The associated groups for each block have to be specified there. The port names and capability bits are updated accordingly after setting each block information.Signed-off-by Takashi Iwai <[email protected]>---
...
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (*blknames) { + strlcat(blknames, ", ", sizeof(blknames)); + strlcat(blknames, (const char *)bp->name, + sizeof(blknames));FYI, this seems to introduce build problems on systems that do not have strlcpy:
During build:
seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:33: warning: implicit declaration of function ‘strlcat’; did you mean ‘strncat’? [-Wimplicit-function-declaration]
672 | strlcat(blknames, ", ",
sizeof(blknames));| ^~~~~~~ | strncatQuoted 7 lines
And then during linking:
/usr/bin/ld: seq/.libs/libseq.a(seqmid.o): in function `update_group_ports':/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:672: undefined reference to `strlcat'/usr/bin/ld:/home/amade/workdir/avs/alsa-lib/src/seq/seqmid.c:673:
undefined reference to `strlcat'
collect2: error: ld returned 1 exit statusThanks, I'll modify it to avoid
strlcat()like below.Takashi
-- 8< --
Subject: [PATCH] seq: Avoidstrlcat()
strlcat()isn't available in every system, so better to avoid it. Rewrite the code withoutstrlcat().Fixes 6167b8ce3e80 ("seq: Add API helper functions for creating UMP Endpoint and Blocks")Signed-off-by Takashi Iwai <[email protected]>--- src/seq/seqmid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)src/seq/seqmid.c +1
-5@@ -635,6 +635,7 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)char blknames[64 ];char name[64 ];unsigned int caps =0 ; +int len; blknames[0 ] =0 ;for (b =0 ; b < ep->num_blocks; b++) {@@ -668,14 +669,13 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)if (!*bp->name)continue ; -if (*blknames) { -strlcat (blknames,", " ,sizeof (blknames)); -strlcat (blknames, (const char *)bp->name, -sizeof (blknames)); - }else {src/seq/seqmid.c static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep) · line 679
Quoted 10 lines
src/seq/seqmid.c +5
-1+ len =strlen (blknames); +if (len) +snprintf (blknames + len,sizeof (blknames) - len, +", %s" , bp->name); +else snd_strlcpy (blknames, (const char *)bp->name,sizeof (blknames)); - } }if (!*blknames)Builds now, but still gives warning:
seqmid.c: In function ‘update_group_ports’:
seqmid.c:675:45: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 61 [-Wformat-truncation=]
675 | ", %s",bp->name);
| ^~
In file included from/usr/include/stdio.h:894,from ../../include/local.h:28, from seq_local.h:26, from seqmid.c:23:In function ‘snprintf’,
inlined from ‘update_group_ports’ at seqmid.c:674:5:/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note:
‘__builtin___snprintf_chk’ output between 3 and 130 bytes into a destination of size 63
71 | return__builtin___snprintf_chk(__s,__n,__USE_FORTIFY_LEVEL- 1,
Quoted 5 lines
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~The compiler gives too much false positives.
Takashi
PATCH 3/4 test: Add an example program to create a virtual UMP Endpoint
In reply to Takashi IwaiProvide an example program to demonstrate how to create a UMP Endpoint and Blocks, i.e. a virtual UMP device.
It's a simple filtering application that just haves the incoming note on/off velocity and sends out to the output. The UMP Endpoint and Block attributes can be adjusted via command-line options.
--- test/Makefile.am | 3 +- test/seq-ump-example.c | 187 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 test/seq-ump-example.c
test/Makefile.am +2 -1
@@ -1,6 +1,6 @@ SUBDIRS=. lsb -check_PROGRAMS=control pcm pcm_min latency seq \ +check_PROGRAMS=control pcm pcm_min latency seq seq-ump-example \ playmidi1 timer rawmidi midiloop \ oldapi queue_timer namehint client_event_filter \ chmap audio_time user-ctl-element-set pcm-multi-thread
@@ -12,6 +12,7 @@ pcm_min_LDADD=../src/libasound.la latency_LDADD=../src/libasound.la latency_LDFLAGS= -lm seq_LDADD=../src/libasound.la +seq_ump_example_LDADD=../src/libasound.la playmidi1_LDADD=../src/libasound.la timer_LDADD=../src/libasound.la rawmidi_LDADD=../src/libasound.la
test/seq-ump-example.c new file +187 -0
187 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 4/4 Add test/seq-ump-example to .gitignore
In reply to Takashi Iwai--- .gitignore | 1 + 1 file changed, 1 insertion(+)
.gitignore +1 -0
@@ -65,6 +65,7 @@ test/playmidi1 test/queue_timer test/rawmidi test/seq +test/seq-ump-example test/timer test/lsb/config test/lsb/midi_event
Signature · 1 line
2.43.0