Skip to content

Commit

Permalink
Add Android system properties to set the device name, set sampling fr…
Browse files Browse the repository at this point in the history
…equency.

1)Add support for ro.produce.model/brand/name system properties.
2)Set SBC frequency to 44100.

Original Change by Nick Pelly. <npelly@google.com>
Moved to Bluez-4 by Jaikumar Ganesh. <jaikumar@google.com>
  • Loading branch information
Jaikumar Ganesh committed May 25, 2011
1 parent 96c354b commit 926ce4d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions audio/a2dp.c
Expand Up @@ -504,10 +504,14 @@ static gboolean sbc_getcap_ind(struct avdtp *session, struct avdtp_local_sep *se
sbc_cap.cap.media_type = AVDTP_MEDIA_TYPE_AUDIO;
sbc_cap.cap.media_codec_type = A2DP_CODEC_SBC;

#ifdef ANDROID
sbc_cap.frequency = SBC_SAMPLING_FREQ_44100;
#else
sbc_cap.frequency = ( SBC_SAMPLING_FREQ_48000 |
SBC_SAMPLING_FREQ_44100 |
SBC_SAMPLING_FREQ_32000 |
SBC_SAMPLING_FREQ_16000 );
#endif

sbc_cap.channel_mode = ( SBC_CHANNEL_MODE_JOINT_STEREO |
SBC_CHANNEL_MODE_STEREO |
Expand Down
25 changes: 25 additions & 0 deletions src/adapter.c
Expand Up @@ -33,6 +33,10 @@
#include <stdlib.h>
#include <sys/ioctl.h>

#ifdef ANDROID_EXPAND_NAME
#include <cutils/properties.h>
#endif

#include <bluetooth/bluetooth.h>
#include <bluetooth/uuid.h>
#include <bluetooth/sdp.h>
Expand Down Expand Up @@ -191,6 +195,10 @@ static char *expand_name(char *dst, int size, char *str, int dev_id)
register int sp, np, olen;
char *opt, buf[10];

#ifdef ANDROID_EXPAND_NAME
char value[PROPERTY_VALUE_MAX];
#endif

if (!str || !dst)
return NULL;

Expand All @@ -210,6 +218,23 @@ static char *expand_name(char *dst, int size, char *str, int dev_id)
opt = main_opts.host_name;
break;

#ifdef ANDROID_EXPAND_NAME
case 'b':
property_get("ro.product.brand", value, "");
opt = value;
break;

case 'm':
property_get("ro.product.model", value, "");
opt = value;
break;

case 'n':
property_get("ro.product.name", value, "");
opt = value;
break;
#endif

case '%':
dst[np++] = str[sp++];
/* fall through */
Expand Down

0 comments on commit 926ce4d

Please sign in to comment.