Commit edcc8d62 authored by Dmitry Shmidt's avatar Dmitry Shmidt
Browse files

Android: P2P: Fix restriction of GO channels on A-band


Bug: 11105901

Change-Id: Ibe8e85f47e95177700deedccb408f1eec85b8f3d
Signed-off-by: default avatarDmitry Shmidt <dimitrysh@google.com>
parent 93d8bfbc
......@@ -418,7 +418,13 @@ void p2p_reselect_channel(struct p2p_data *p2p,
/* Prefer a 5 GHz channel */
for (i = 0; i < intersection->reg_classes; i++) {
#ifdef ANDROID_P2P
struct p2p_reg_class prc;
struct p2p_reg_class *c = &prc;
p2p_copy_reg_class(c, &intersection->reg_class[i]);
#else
struct p2p_reg_class *c = &intersection->reg_class[i];
#endif
if ((c->reg_class == 115 || c->reg_class == 124) &&
c->channels) {
unsigned int r;
......
......@@ -572,6 +572,9 @@ void p2p_channels_intersect(const struct p2p_channels *a,
struct p2p_channels *res);
int p2p_channels_includes(const struct p2p_channels *channels, u8 reg_class,
u8 channel);
#ifdef ANDROID_P2P
size_t p2p_copy_reg_class(struct p2p_reg_class *dc, struct p2p_reg_class *sc);
#endif
/* p2p_parse.c */
int p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg);
......
......@@ -244,12 +244,37 @@ int p2p_channels_includes_freq(const struct p2p_channels *channels,
}
#ifdef ANDROID_P2P
static int p2p_block_op_freq(unsigned int freq)
{
return (freq >= 5170 && freq < 5745);
}
size_t p2p_copy_reg_class(struct p2p_reg_class *dc, struct p2p_reg_class *sc)
{
unsigned int i;
dc->reg_class = sc->reg_class;
dc->channels = 0;
for (i=0; i < sc->channels; i++) {
if (!p2p_block_op_freq(p2p_channel_to_freq(sc->reg_class,
sc->channel[i]))) {
dc->channel[dc->channels] = sc->channel[i];
dc->channels++;
}
}
return dc->channels;
}
#endif
int p2p_supported_freq(struct p2p_data *p2p, unsigned int freq)
{
u8 op_reg_class, op_channel;
#ifdef ANDROID_P2P
if (freq >= 5170 && freq < 5745)
if (p2p_block_op_freq(freq))
return 0;
#endif
if (p2p_freq_to_channel(freq, &op_reg_class, &op_channel) < 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment