From: Brad Midgley <bmidgley@xmission.com>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] AVDTP socket?
Date: Fri, 19 Nov 2004 14:51:20 -0700 [thread overview]
Message-ID: <419E6AD8.7050104@xmission.com> (raw)
In-Reply-To: <1100897144.7213.63.camel@pegasus>
Marcel,
I added rcplay.c to cvs and made you a developer on bluetooth-alsa so
you can tweak things if you see fit.
The bluetake sometimes works and sometimes doesn't when using a2play.
The same stream will work a couple of times and then it produces loud
white noise. There is probably something still not quite right.
I disabled this section in a2dp.c
memset(buf, 0, 12);
buf[0] = 0x80;
buf[2] = seq_num >> 8;
buf[3] = seq_num & 0xff;
buf[12] = 0x0ff;
buf[13] = 0x0ff;
memcpy(buf + 14, &sbc_info, sizeof(sbc_info));
size = read(fd, buf + 14 + sizeof(sbc_info), mtu - sizeof(sbc_info) -
14);
write(streamfd, buf, size + 14 + sizeof(sbc_info));
seq_num++;
but it didn't help or hurt. I couldn't see why sbc_info was being
written to the stream since I thought it was just a file header. Does
your headset work with a2play as it is in cvs now?
Brad
Marcel Holtmann wrote:
> Hi Brad,
>
>
>>actually like with the attached patch. Most of the example *.sbc files
>>are working. Some of them are not working and this is maybe because the
>>frame header information don't matches the SBC configuration. Or maybe
>>hcidump is decoding this wrong.
>
>
> and I figured out what the extra RFCOMM channel 1 on my Aiptek headphone
> does. You can simply stream the SBC files over it. The attached program
> will do this for you, but actually it only works on streams with two
> channels. I don't know what to change to support all test SBC files.
>
> Regards
>
> Marcel
>
>
>
> ------------------------------------------------------------------------
>
> /*
> *
> * Stream SBC files over RFCOMM
> *
> * Copyright (C) 2004 Marcel Holtmann <marcel@holtmann.org>
> *
> *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation;
> *
> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
> * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
> * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
> * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> *
> * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
> * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
> * SOFTWARE IS DISCLAIMED.
> *
> */
>
> #include <stdio.h>
> #include <errno.h>
> #include <fcntl.h>
> #include <sys/socket.h>
>
> #include <bluetooth/bluetooth.h>
> #include <bluetooth/rfcomm.h>
>
> static int rfcomm_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t channel)
> {
> struct sockaddr_rc addr;
> int sk;
>
> sk = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
> if (sk < 0)
> return -1;
>
> memset(&addr, 0, sizeof(addr));
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, src);
> if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
>
> memset(&addr, 0, sizeof(addr));
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, dst);
> addr.rc_channel = channel;
> if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
>
> return sk;
> }
>
> static int stream_sbc(fd, sk)
> {
> unsigned char buf[330];
> int err, len;
>
> while (1) {
> len = read(fd, buf, sizeof(buf));
> if (len <= 0)
> break;
>
> err = write(sk, buf, len);
> if (err < 0)
> break;
> }
>
> return 0;
> }
>
> int main(int argc, char *argv[])
> {
> bdaddr_t bdaddr;
> int fd, sk;
>
> if (argc < 3) {
> fprintf(stderr, "Usage: rcplay <bdaddr> <filename>\n");
> exit(1);
> }
>
> str2ba(argv[1], &bdaddr);
>
> fd = open(argv[2], O_RDONLY);
> if (fd < 0) {
> perror("Can't open file");
> exit(1);
> }
>
> sk = rfcomm_connect(BDADDR_ANY, &bdaddr, 1);
> if (sk < 0) {
> perror("Can't open connection");
> close(fd);
> exit(1);
> }
>
> stream_sbc(fd, sk);
>
> close(sk);
> close(fd);
>
> return 0;
> }
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2004-11-19 21:51 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-07 5:36 [Bluez-devel] AVDTP socket? Brad Midgley
2004-11-07 12:27 ` Marcel Holtmann
2004-11-07 16:34 ` Brad Midgley
2004-11-07 16:54 ` Marcel Holtmann
2004-11-07 18:55 ` Brad Midgley
2004-11-07 21:33 ` Marcel Holtmann
2004-11-10 5:46 ` Brad Midgley
2004-11-10 8:47 ` Marcel Holtmann
2004-11-10 18:01 ` Brad Midgley
2004-11-10 18:57 ` Marcel Holtmann
2004-11-12 23:13 ` Brad Midgley
2004-11-13 0:38 ` Marcel Holtmann
2004-11-13 3:13 ` Brad Midgley
2004-11-13 13:06 ` Marcel Holtmann
2004-11-14 7:54 ` Brad Midgley
2004-11-14 15:29 ` Marcel Holtmann
2004-11-17 15:47 ` Brad Midgley
2004-11-17 15:52 ` Marcel Holtmann
2004-11-17 19:52 ` Brad Midgley
2004-11-17 20:01 ` Marcel Holtmann
2004-11-18 13:27 ` Henryk Plötz
2004-11-18 15:26 ` Brad Midgley
2004-11-18 19:11 ` Marcel Holtmann
2004-11-19 18:32 ` Henryk Plötz
2004-11-19 21:40 ` Brad Midgley
2004-11-18 23:59 ` Marcel Holtmann
2004-11-19 9:03 ` Brad Midgley
2004-11-19 11:41 ` Marcel Holtmann
2004-11-19 16:35 ` Brad Midgley
2004-11-19 16:53 ` Marcel Holtmann
2004-11-19 17:39 ` Marcel Holtmann
2004-11-19 20:45 ` Marcel Holtmann
2004-11-19 21:20 ` Henryk Plötz
2004-11-19 21:33 ` Marcel Holtmann
2004-11-19 23:58 ` Henryk Plötz
2004-11-19 21:51 ` Brad Midgley [this message]
2004-11-19 22:04 ` Marcel Holtmann
2004-11-19 23:23 ` Brad Midgley
2004-11-20 0:09 ` Marcel Holtmann
2004-11-20 0:04 ` Henryk Plötz
2004-11-20 0:43 ` Marcel Holtmann
2004-11-20 0:50 ` Henryk Plötz
2004-11-20 5:04 ` Marcel Holtmann
2004-11-19 18:44 ` Henryk Plötz
2004-11-19 18:38 ` Henryk Plötz
2004-11-19 18:56 ` Marcel Holtmann
2004-11-19 21:06 ` Henryk Plötz
2004-11-19 21:23 ` Marcel Holtmann
2004-11-21 5:46 ` Henryk Plötz
2004-11-21 17:44 ` Marcel Holtmann
2004-11-22 3:18 ` Marcel Holtmann
2004-11-22 4:32 ` Henryk Plötz
2004-11-22 13:28 ` Marcel Holtmann
2004-11-23 0:53 ` Henryk Plötz
2004-11-23 6:22 ` Marcel Holtmann
2004-11-22 4:22 ` [Bluez-devel] sbc reindent Brad Midgley
2004-11-15 8:24 ` [Bluez-devel] AVDTP socket? Sebastien
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=419E6AD8.7050104@xmission.com \
--to=bmidgley@xmission.com \
--cc=bluez-devel@lists.sourceforge.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.