summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-12-20 20:57:27 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-12-20 20:57:27 +0200
commit450e5656a8de08051f221d63e026c259151ef274 (patch)
treec1c9aab7981a5471d3a83767a3fc8cad24bd5c2f /audio
parent1c7291138ae3d25d7f34803e4f354a90d012f6a1 (diff)
More length header fixes
Diffstat (limited to 'audio')
-rw-r--r--audio/pcm_bluetooth.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 9b860c31..244d08d1 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -430,35 +430,38 @@ static int bluetooth_hsp_hw_params(snd_pcm_ioplug_t *io,
{
struct bluetooth_data *data = io->private_data;
char buf[BT_SUGGESTED_BUFFER_SIZE];
- bt_audio_msg_header_t *rsp = (void*) buf;
- struct bt_set_configuration_req *setconf_req = (void*) buf;
- struct bt_set_configuration_rsp *setconf_rsp = (void*) buf;
+ struct bt_set_configuration_req *req = (void*) buf;
+ struct bt_set_configuration_rsp *rsp = (void*) buf;
int err;
DBG("Preparing with io->period_size=%lu io->buffer_size=%lu",
io->period_size, io->buffer_size);
- memset(setconf_req, 0, BT_SUGGESTED_BUFFER_SIZE);
- setconf_req->h.type = BT_REQUEST;
- setconf_req->h.name = BT_SET_CONFIGURATION;
+ memset(req, 0, BT_SUGGESTED_BUFFER_SIZE);
+ req->h.type = BT_REQUEST;
+ req->h.name = BT_SET_CONFIGURATION;
+ req->h.length = sizeof(*req);
- strncpy(setconf_req->device, data->alsa_config.device, 18);
- setconf_req->codec.transport = BT_CAPABILITIES_TRANSPORT_SCO;
- setconf_req->access_mode = (io->stream == SND_PCM_STREAM_PLAYBACK ?
+ strncpy(req->device, data->alsa_config.device, 18);
+ req->codec.transport = BT_CAPABILITIES_TRANSPORT_SCO;
+ req->codec.length = sizeof(pcm_capabilities_t);
+ req->access_mode = (io->stream == SND_PCM_STREAM_PLAYBACK ?
BT_CAPABILITIES_ACCESS_MODE_WRITE :
BT_CAPABILITIES_ACCESS_MODE_READ);
- err = audioservice_send(data->server.fd, &setconf_req->h);
+ req->h.length += req->codec.length - sizeof(req->codec);
+ err = audioservice_send(data->server.fd, &req->h);
if (err < 0)
return err;
- err = audioservice_expect(data->server.fd, rsp,
+ rsp->h.length = sizeof(*rsp);
+ err = audioservice_expect(data->server.fd, &rsp->h,
BT_SET_CONFIGURATION);
if (err < 0)
return err;
- data->transport = setconf_rsp->transport;
- data->link_mtu = setconf_rsp->link_mtu;
+ data->transport = rsp->transport;
+ data->link_mtu = rsp->link_mtu;
return 0;
}