[OnePlus 3 & 3T Cross Device Development] :
5GHz hotspot

For me (vodafone.de; mcc=262, mnc=02) the 5GHz hot spot is always fired up on channel 157/5785MHz. Besides the fact that no European wifi device can use this channe/freq, in Germany it's prohibitted to broadcast on this channel, if one hasn't been licenced to do so. In Germany using this freq without being licenced, isn't a minor breach of law, but a crime.

Considering this it should be a high priority task to either fix this, or disable the selection of 5GHz all together. I've tried to debug this, but now I'm stuck and need help.

To see what's hap0ening I've added aome debugging, and tried to force a (European/German) legal freq: channel 44/5220MHz.

https://github.com/nvertigo/android...mmit/950adab4d870ecd83564f3e6c5ba77d9f2f57430

https://github.com/nvertigo/android...mmit/a4829959a3333c0a0d553f7f468f37c49b38a0a0

The first problem is here (obviously the countrycode is set, but not honored):

01-29 20:31:57.861 2523 3390 E ApConfigUtil: nvertigo: updateApChannelConfig: default band: 0; default channel: 6
01-29 20:31:57.862 2523 3390 E ApConfigUtil: nvertigo: updateApChannelConfig: band: 1; channel: 0
01-29 20:31:57.863 2523 3390 D ApConfigUtil: nvertigo: Forcing channel 44; computed freq: 5745; computed channel: 149
01-29 20:31:57.863 2523 3390 D ApConfigUtil: nvertigo: allowed freqs: [5180, 5200, 5220, 5240, 5745, 5765, 5785, 5805, 5825, 5845]; allowed5GFreqList.length: 10
01-29 20:31:57.863 2523 3390 E ApConfigUtil: nvertigo: config.apChannel: 44
01-29 20:31:57.869 2523 3390 D WificondControl: nvertigo: startHotspot: true
01-29 20:31:57.869 2523 3390 D WificondControl: nvertigo: startHotspot: successfull
01-29 20:31:58.001 6441 6441 I hostapd : ACS: nvertigo: hostapd_drv_do_acs succeeded.
01-29 20:31:58.002 2523 3390 D SoftApManager: nvertigo: Soft AP is started: wlan0channel: 44
01-29 20:31:58.202 6441 6441 I hostapd : wlan0: ACS-COMPLETED freq=5785 channel=157
01-29 20:31:58.435 2026 2026 I wificond: New channel on frequency: 5785 with bandwidth: 80MHz
01-29 20:31:58.495 6441 6441 I hostapd : wlan0: IEEE 802.11 driver had channel switch: freq=5785, ht=1, offset=1, width=3 (80 MHz), cf1=5775, cf2=0
01-29 20:31:58.495 6441 6441 I hostapd : wlan0: IEEE 802.11 driver had channel switch: freq=5785, ht=1, offset=1, width=3 (80 MHz), cf1=5775, cf2=0
01-29 20:31:58.495 6441 6441 I hostapd : wlan0: AP-CSA-FINISHED freq=5785 dfs=0

The allowed freqs are just wrong: it is "5180, 5200, 5220, 5240, 5745, 5765, 5785, 5805, 5825, 5845", while for country code EU or DE only "5180, 5200, 5220, 5240" are allowed for wifi.

I circumvent this the ard way: I force the channel to 44, no matter whats randomly picked from the wrong allowed list.

Now it gets awarkned: no matter what channel is requested by the framework, after hostapd has completed this part:

https://github.com/nvertigo/android...553f7f468f37c49b38a0a0/src/ap/acs.c#L911-L919

the hotspot is started on 157. :(

Any help is highly appriciated!

I also wonder if this is an op3/t specific issue, or if this is a general issue.

Next question: if frameworks/opt/net/wifi is calculating the channel, why is the Automatic Channel Selection (ACS) passed down to the wlan driver? And (most confusing me): where, when and how is the countrycode passed down to tne driver?mAnd one more: on boot (before even touching the hotspot switch the log shows:

01-29 20:31:09.628 2026 2026 I wificond: 2.4Ghz frequencies: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
01-29 20:31:09.628 2026 2026 I wificond: 5Ghz non-DFS frequencies: 5180 5200 5220 5240 5745 5765 5785 5805 5825 5845
01-29 20:31:09.628 2026 2026 I wificond: 5Ghz DFS frequencies: 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 56

Immidiatly after touching the switch, the log shows:

01-29 20:31:57.747 2026 2026 I wificond: 2.4Ghz frequencies:
01-29 20:31:57.747 2026 2026 I wificond: 5Ghz non-DFS frequencies:
01-29 20:31:57.747 2026 2026 I wificond: 5Ghz DFS frequencies:

Complete log attached.