git: bbf71b315967 - main - sound: Fix SEQ_SYSEX() macro

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sun, 22 Sep 2024 15:31:57 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=bbf71b31596719c61d540513da3d8a3db20dad66

commit bbf71b31596719c61d540513da3d8a3db20dad66
Author:     Rozhuk Ivan <rozhuk.im@gmail.com>
AuthorDate: 2024-08-09 18:52:17 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-09-22 15:27:29 +0000

    sound: Fix SEQ_SYSEX() macro
    
    Correct implementation also found in Linux's soundcard.h:
    https://github.com/torvalds/linux/blob/master/include/uapi/linux/soundcard.h#L1178
    
    seq_processevent() interprets event[1] as device number and does not
    work properly with current SEQ_SYSEX() implementation.
    
    Note: soundcard.h has its own funky style, which this commit follows
    
    Reviewed by: imp, christos
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1374
---
 sys/sys/soundcard.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/sys/soundcard.h b/sys/sys/soundcard.h
index b5434b930215..304ae38c08d4 100644
--- a/sys/sys/soundcard.h
+++ b/sys/sys/soundcard.h
@@ -1400,8 +1400,9 @@ void seqbuf_dump(void);	/* This function must be provided by programs */
 	int i, l=(len); if (l>6)l=6;\
 	_SEQ_NEEDBUF(8);\
 	_seqbuf[_seqbufptr] = EV_SYSEX;\
-	for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\
-	for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\
+	_seqbuf[_seqbufptr+1] = (dev);\
+	for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+2] = (buf)[i];\
+	for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+2] = 0xff;\
 	_SEQ_ADVBUF(8);}
 
 #define SEQ_CHN_PRESSURE(dev, chn, pressure) \