intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
431 stars 239 forks source link

Frequency is not changing - sta1.wintfs[0].setFreq(2437) #489

Closed andredemori closed 1 year ago

andredemori commented 1 year ago

I'm trying to change the frequency, but after the command sta1.wintfs[0].setFreq(2437) the frequency still the same like showed below:

*** Running CLI
*** Starting CLI:
mininet-wifi> py sta1.wintfs[0].freq
2.432

It is an adhoc network


net.addLink(sta1, cls=adhoc, intf='sta1-wlan1',
                ssid='adhocNet', mode='g', channel=5, ht_cap='HT40+', **kwargs)
net.addLink(sta1, cls=adhoc, intf='sta1-wlan0',
                ssid='adhocNet', mode='g', channel=5, ht_cap='HT40+', **kwargs)
ramonfontes commented 1 year ago

Please use iw instead.

andredemori commented 1 year ago

I tried:

sta1.wintfs[0].cmd('iw dev %s set freq %d' % (sta1.wintfs[0].name, 2437))

sta1.wintfs[0].cmd('iw dev %s set freq %d' % (sta1.params['wlan'][0], 2437))

sta1.wintfs[0].cmd('wpa_cli -i %s set freq 2437' % sta1.wintfs[0].name)

But none worked and the frequency still the same

mininet-wifi> py sta1.wintfs[0].freq
2.432
ramonfontes commented 1 year ago

Can you please check the iw doc and try the commands via terminal?

andredemori commented 1 year ago

I'm trying via terminal with xterm sta1

iw dev sta1-wlan0 set freq 2437

but i'm receiving the following error:

device or resource busy

Anyway, I realy need to change frequency directly in the code, without access terminal via xterm because of my application that calls mininet-wifi

ramonfontes commented 1 year ago

device or resource busy

This is something particular to iw. Sometimes you have to bring the interface down. You need to check its doc.

Anyway, I realy need to change frequency directly in the code, without access terminal via xterm because of my application that calls mininet-wifi

You may program your own methods with the commands you need to use.

ramonfontes commented 1 year ago

Closing due to no new interactions.