public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Till Harbaum <harbaum@beecon.de>
To: bluez-devel@lists.sf.net
Subject: [Bluez-devel] Small bugfix for hstest
Date: Mon, 30 Aug 2004 17:53:25 +0200	[thread overview]
Message-ID: <200408301753.25934.harbaum@beecon.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

Hi,

i have played around with hstest and some uart based hardware and found a 
problem, that only seems to happen with uart based devices:

A client may receive sco data packets that are bigger than the sco mtu. hstest 
returns packets of exactly the same size of the packets it received. If the 
packet received is bigger then the sco mtu, then packets bigger than sco mtu 
are being sent and being dropped in the kernel. As a result, no data is being 
sent at all. Instead multiple smaller sco packets should be sent.

The attached patch has to be applied to bluez-utils/test/hstest.c and fixes 
the problem inside hstest. It would as well be possible to make the kernel 
sco code detect this and fragment the payload accordingly. But imho this 
should be done in the application.

Regards,
  Till

-- 
Dr.-Ing. Till Harbaum                       Tel.:  +49 721 4998963
BeeCon GmbH                                 Fax:   +49 721 4998962
Haid-und-Neu Strasse 7, 76131 Karlsruhe     Mobil: +49 179 9087904
harbaum@beecon.de                           http://www.beecon.de

[-- Attachment #2: hstest-uart.patch --]
[-- Type: text/x-diff, Size: 691 bytes --]

--- hstest.c.old	2004-08-28 13:11:11.000000000 +0200
+++ hstest.c	2004-08-28 13:14:45.000000000 +0200
@@ -148,7 +148,7 @@
 
 	fd_set rfds;
 	struct timeval timeout;
-	unsigned char buf[2048];
+	unsigned char buf[2048], *p;
 	int maxfd, sel, rlen, wlen;
 
 	bdaddr_t local;
@@ -274,7 +274,15 @@
 					switch (mode) {
 					case PLAY:
 						rlen = read(fd, buf, rlen);
-						wlen = write(sd, buf, rlen);
+
+						wlen = 0; 
+						p = buf;
+						while(rlen > sco_mtu) {
+						        wlen += write(sd, p, sco_mtu);
+						        rlen -= sco_mtu;
+						        p += sco_mtu;
+						}
+						wlen += write(sd, p, rlen);
 						break;
 					case RECORD:
 						wlen = write(fd, buf, rlen);

             reply	other threads:[~2004-08-30 15:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-30 15:53 Till Harbaum [this message]
2004-08-30 16:07 ` [Bluez-devel] Small bugfix for hstest Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408301753.25934.harbaum@beecon.de \
    --to=harbaum@beecon.de \
    --cc=bluez-devel@lists.sf.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox