Android: P2P: Fix restriction of GO channels on A-band
Bug: 11105901
Change-Id: Ibe8e85f47e95177700deedccb408f1eec85b8f3d
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index 0769ede..a4c48f6 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -244,12 +244,37 @@
}
+#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)