berate_ap icon indicating copy to clipboard operation
berate_ap copied to clipboard

Grep for frequencies does not accomodate my adapter's output

Open Mauville opened this issue 8 months ago • 3 comments

Hello, I'm using an RT5572 adapter, and when I run the command

iw phy phy0 info

I get the following frequencies

Frequencies:
                        * 2412.0 MHz [1] (20.0 dBm)
                        * 2417.0 MHz [2] (20.0 dBm)
                        * 2422.0 MHz [3] (20.0 dBm)
                        * 2427.0 MHz [4] (20.0 dBm)
                        * 2432.0 MHz [5] (20.0 dBm)
                        * 2437.0 MHz [6] (20.0 dBm)
                        * 2442.0 MHz [7] (20.0 dBm)
                        * 2447.0 MHz [8] (20.0 dBm)
                        * 2452.0 MHz [9] (20.0 dBm)
                        * 2457.0 MHz [10] (20.0 dBm)
                        * 2462.0 MHz [11] (20.0 dBm)
                        * 2467.0 MHz [12] (20.0 dBm) (no IR)
                        * 2472.0 MHz [13] (20.0 dBm) (no IR)
                        * 2484.0 MHz [14] (20.0 dBm) (no IR)

The grep part of the can_transmit_to_channel() function currently tries to find the string with: CHANNEL_INFO=$(get_adapter_info ${IFACE} | grep " 24[0-9][0-9] MHz \[${CHANNEL_NUM}\]")

This pattern does not match frequencies listed in a float format (e.g., 2412.0 MHz).

I am not aware if this is a general change in iw behavior or just an issue with my card.

I've changed the code of the script to accommodate for my version like follows, but I do not know if this is something worth incorporating into the codebase. CHANNEL_INFO=$(get_adapter_info ${IFACE} | grep "24[0-9][0-9]\(\.[0-9]\)\? MHz 8" \[${CHANNEL_NUM}\]")

Mauville avatar Jun 18 '24 04:06 Mauville