From 97c120e3f1425d9c431c12167ca4684a0af5f844 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 25 Aug 2007 17:46:57 +0000 Subject: Use device string for the IPC --- audio/Makefile.am | 6 +++--- audio/ipc.h | 3 +-- audio/pcm_bluetooth.c | 9 +++++---- audio/unix.c | 7 +++++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/audio/Makefile.am b/audio/Makefile.am index 42fd1590..6d1e75d8 100644 --- a/audio/Makefile.am +++ b/audio/Makefile.am @@ -25,12 +25,12 @@ alsa_LTLIBRARIES = libasound_module_pcm_bluetooth.la libasound_module_ctl_blueto libasound_module_pcm_bluetooth_la_SOURCES = pcm_bluetooth.c ipc.h libasound_module_pcm_bluetooth_la_LDFLAGS = -module -avoid-version -export-dynamic -libasound_module_pcm_bluetooth_la_LIBADD = @SBC_LIBS@ @BLUEZ_LIBS@ @ALSA_LIBS@ -libasound_module_pcm_bluetooth_la_CFLAGS = @ALSA_CFLAGS@ @BLUEZ_CFLAGS@ @SBC_CFLAGS@ +libasound_module_pcm_bluetooth_la_LIBADD = @SBC_LIBS@ @ALSA_LIBS@ +libasound_module_pcm_bluetooth_la_CFLAGS = @ALSA_CFLAGS@ @SBC_CFLAGS@ libasound_module_ctl_bluetooth_la_SOURCES = ctl_bluetooth.c ipc.h libasound_module_ctl_bluetooth_la_LDFLAGS = -module -avoid-version -export-dynamic -libasound_module_ctl_bluetooth_la_LIBADD = @ALSA_LIBS@ +libasound_module_ctl_bluetooth_la_LIBADD = @ALSA_LIBS@ libasound_module_ctl_bluetooth_la_CFLAGS = @ALSA_CFLAGS@ endif diff --git a/audio/ipc.h b/audio/ipc.h index 7eb6e398..5279fa2a 100644 --- a/audio/ipc.h +++ b/audio/ipc.h @@ -22,7 +22,6 @@ */ #include -#include #define IPC_TYPE_CONNECT 0x0001 @@ -52,7 +51,7 @@ #define PKT_ERROR_NONE 0 struct ipc_packet { - bdaddr_t bdaddr; /* Address of the remote Device */ + char device[18]; /* Address of the remote Device */ uint8_t role; /* Audio role eg: voice, wifi, auto... */ uint8_t type; /* Packet type */ uint8_t error; /* Packet error code */ diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c index 8fb560a4..0ddd67ab 100644 --- a/audio/pcm_bluetooth.c +++ b/audio/pcm_bluetooth.c @@ -36,9 +36,6 @@ #include #include -#include -#include - #include "ipc.h" #include "sbc.h" @@ -56,6 +53,10 @@ #define DBG(fmt, arg...) #endif +#ifndef SOL_SCO +#define SOL_SCO 17 +#endif + #ifndef SCO_TXBUFS #define SCO_TXBUFS 0x03 #endif @@ -928,7 +929,7 @@ static int bluetooth_cfg(struct bluetooth_data *data, snd_config_t *conf) return -EINVAL; } - str2ba(addr, &pkt->bdaddr); + strncpy(pkt->device, addr, 18); continue; } diff --git a/audio/unix.c b/audio/unix.c index a04c5bfb..246d6813 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -305,18 +305,21 @@ static void cfg_event(struct unix_client *client, struct ipc_packet *pkt, int ret, fd; unsigned int id; struct a2dp_data *a2dp; + bdaddr_t bdaddr; const char *interface = NULL; + str2ba(pkt->device, &bdaddr); + if (pkt->role == PKT_ROLE_VOICE) interface = AUDIO_HEADSET_INTERFACE; else if (pkt->role == PKT_ROLE_HIFI) interface = AUDIO_SINK_INTERFACE; - dev = manager_find_device(&pkt->bdaddr, interface, TRUE); + dev = manager_find_device(&bdaddr, interface, TRUE); if (dev) goto proceed; - dev = manager_find_device(&pkt->bdaddr, interface, FALSE); + dev = manager_find_device(&bdaddr, interface, FALSE); if (!dev) goto failed; -- cgit