NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR/57436 CVS commit: src/sys/dev/pad



The following reply was made to PR kern/57436; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Sun, 28 May 2023 06:35:32 -0000 (UTC)

 bmelo%protonmail.com@localhost (Bruno Melo) writes:
 
 >The following reply was made to PR kern/57436; it has been noted by GNATS.
 
 >From: Bruno Melo <bmelo%protonmail.com@localhost>
 >To: gnats-bugs%netbsd.org@localhost
 >Cc: nat%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
 >Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
 >Date: Sat, 27 May 2023 18:09:52 +0000
 
 > Hi nat,
 > 
 > I'm reporting this PR/57443 too related to uaudio bug. If you can check the=
 > n I can test both fixes at once.
 
 
 Replacing the single read in bta2dpd with a read loop (to collect
 data from partial reads) should restore the old behaviour.
 
 http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/bta2dpd.diff
 
 Index: usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c,v
 retrieving revision 1.10
 diff -p -u -r1.10 sbc_encode.c
 --- usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	21 Sep 2019 00:01:33 -0000	1.10
 +++ usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	28 May 2023 06:32:56 -0000
 @@ -813,6 +813,29 @@ make_frame(uint8_t *frame, int16_t *inpu
  	return frame - frameStart;
  }
  
 +static ssize_t
 +readloop(int fd, void *buf, size_t nbytes)
 +{
 +	size_t count;
 +	ssize_t ret;
 +
 +	count = 0;
 +	while (nbytes > 0) {
 +		ret = read(fd, ((char *)buf) + count, nbytes);
 +		if (ret < 0) {
 +			if (count == 0)
 +				return ret;
 +			break;
 +		}
 +		if (ret == 0)
 +			break;
 +		count += (size_t)ret;
 +		nbytes -= (size_t)ret;
 +	}
 +
 +	return (ssize_t) count;
 +}
 +
  ssize_t
  stream(int in, int outfd, uint8_t mode, uint8_t freq, uint8_t bands, uint8_t
      blocks, uint8_t alloc_method, uint8_t bitpool, size_t mtu, int volume)
 @@ -891,7 +914,7 @@ stream(int in, int outfd, uint8_t mode, 
  	pkt_len = 80;
  	while (totalSize + ((size_t)pkt_len * 2) <= mtu) {
  
 -		len = read(in, music, readsize);
 +		len = readloop(in, music, readsize);
  		if (len < (int)readsize)
  			break;
  
 
 
 Greetings,
 


Home | Main Index | Thread Index | Old Index