[pulseaudio-discuss] [PATCH 5/5] backend-native: add a new native headset backend

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Sep 11 01:22:55 PDT 2014


(Arun's mail didn't seem to reach the list, so I have to reply to Luiz
to answer Arun's question.)

On Thu, 2014-09-11 at 10:49 +0300, Luiz Augusto von Dentz wrote:
> Hi Arun,
> 
> On Thu, Sep 11, 2014 at 7:32 AM, Arun Raghavan <arun at accosted.net> wrote:
> > On 8 September 2014 14:45, Wim Taymans <wim.taymans at gmail.com> wrote:
> >> +static int bluez5_sco_acquire_cb(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu) {
> >> +    pa_bluetooth_device *d = t->device;
> >> +    struct sockaddr_sco addr;
> >> +    int err, i;
> >> +    int sock;
> >> +    bdaddr_t src;
> >> +    bdaddr_t dst;
> >> +    const char *src_addr, *dst_addr;
> >> +
> >> +    src_addr = d->adapter->address;
> >> +    dst_addr = d->address;
> >> +
> >> +    for (i = 5; i >= 0; i--, src_addr += 3)
> >> +        src.b[i] = strtol(src_addr, NULL, 16);
> >> +    for (i = 5; i >= 0; i--, dst_addr += 3)
> >> +        dst.b[i] = strtol(dst_addr, NULL, 16);
> >> +
> >> +    sock = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
> >> +    if (sock < 0) {
> >> +        pa_log_error("socket(SEQPACKET, SCO) %s", pa_cstrerror(errno));
> >> +        return -1;
> >> +    }
> >> +
> >> +    memset(&addr, 0, sizeof(addr));
> >> +    addr.sco_family = AF_BLUETOOTH;
> >> +    bacpy(&addr.sco_bdaddr, &src);
> >> +
> >> +    if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> >> +        pa_log_error("bind(): %s", pa_cstrerror(errno));
> >> +        goto fail_close;
> >> +    }
> >> +
> >> +    memset(&addr, 0, sizeof(addr));
> >> +    addr.sco_family = AF_BLUETOOTH;
> >> +    bacpy(&addr.sco_bdaddr, &dst);
> >> +
> >> +    pa_log_info ("doing connect\n");
> >> +    err = connect(sock, (struct sockaddr *) &addr, sizeof(addr));
> >> +    if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS)) {
> >> +        pa_log_error("connect(): %s", pa_cstrerror(errno));
> >> +        goto fail_close;
> >> +    }
> >> +
> >> +    if (imtu)
> >> +        *imtu = 48;
> >> +
> >> +    if (omtu)
> >> +        *omtu = 48;
> >
> > Out of curiosity, are these values fixed in the spec?

No. See the bottom of this mail:
http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/21016/focus=21182

-- 
Tanu



More information about the pulseaudio-discuss mailing list