Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error message printed when not using an AP supporting wifi card #476

Closed
tmuehlhoff opened this issue Dec 30, 2019 · 12 comments · Fixed by #490
Closed

No error message printed when not using an AP supporting wifi card #476

tmuehlhoff opened this issue Dec 30, 2019 · 12 comments · Fixed by #490

Comments

@tmuehlhoff
Copy link

tmuehlhoff commented Dec 30, 2019

(Forgive me the meaningless title, I hit Enter mistakenly ;) )
Tried to use the tool on a Thinkpad T500, Ubuntu Bionic, e1000e driver of kernel 4.15.0-73.
The Wifi HW is:
03:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300 (8086:4236)

Obviously this adapter doesn't allow AP mode... it's been set to master, but the rest doesn't seem to work

console:
Starting smart config pairing procedure
Waiting for the device to install the intermediate firmware
Put device in EZ config mode (blinking fast)
Sending SSID vtrust-flash
Sending wifiPassword
Sending token 00000000
Sending secret 0101
Traceback (most recent call last):
File "./smartconfig/main.py", line 26, in
smartconfig( passwd, ssid, region, token, secret )
File "/home/to/tuya-convert/scripts/smartconfig/smartconfig.py", line 46, in smartconfig
sock = SmartConfigSocket()
File "/home/to/tuya-convert/scripts/smartconfig/smartconfig.py", line 29, in init
self._socket.bind((address, 0))
OSError: [Errno 99] Cannot assign requested address
.......................................

smarthack-wifi.log
Attempting to stop wpa_supplicant
Stopping NetworkManager...
Configuring AP interface...
RTNETLINK answers: File exists
Starting DNSMASQ server...
Starting AP on wlp3s0...
Configuration file: /dev/stdin
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlp3s0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlp3s0: interface state UNINITIALIZED->DISABLED
wlp3s0: AP-DISABLED
hostapd_free_hapd_data: Interface wlp3s0 wasn't started
AP closed
Stopping DNSMASQ server...
Restarting NetworkManager...

I later used a USB stick (idVendor=0bda, idProduct=8176
....
rtl8192cu: Chip version 0x10
rtl8192cu: Board Type 0
....
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
....

which worked ok, thus I suspect the Intel not to like the master mode

Pre-Condition was to "rfkill unblock" the devices previous to starteing the script. This could be captured in the script, I think ;)

Nice work!!! /To

@kueblc
Copy link
Collaborator

kueblc commented Dec 30, 2019

Hi @tmuehlhoff, are you saying that tuya-convert is not working with a wifi adapter that does not support AP mode? This is expected as AP mode is required to, well, create an AP.

@tmuehlhoff
Copy link
Author

Yeah sure, but what I'm after is an according error output....

nl80211: Could not configure driver mode

Could cause to output one, or ?

Also it could issue an rfkill unblock....

@kueblc
Copy link
Collaborator

kueblc commented Dec 31, 2019

Sorry I don't understand what you are asking. If your card does not support AP mode, you will get errors if you try anyway. None of the services can start if that first step fails.

@tmuehlhoff
Copy link
Author

What about an error message if the wifi chip isn't supported ?

@kueblc
Copy link
Collaborator

kueblc commented Jan 1, 2020

We do this already. Can you specify what you think it should do differently?

@tmuehlhoff
Copy link
Author

well, as you can see from above, I didn't receive any, only took that info from the logs...

my shell output:
Starting smart config pairing procedure
Waiting for the device to install the intermediate firmware
Put device in EZ config mode (blinking fast)
Sending SSID vtrust-flash
Sending wifiPassword
Sending token 00000000
Sending secret 0101

@tmuehlhoff
Copy link
Author

obviously my intel card doesn't produce that error message you're matching on... Let me try to reproduce it, I will come back with some more info on why this isn't catched.

@tmuehlhoff
Copy link
Author

tmuehlhoff commented Jan 6, 2020

Got it: if you just grep for "AP" in iw list it will find the string "AP" even though it's not supported by the adapter:

$ iw list | grep AP
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
	Driver supports full state transitions for AP/GO clients

but:

    Supported interface modes:
             * IBSS
             * managed
             * monitor

does not list AP mode.
Sure you can now argue this is maybe an interface fault, but it's an Intel "Ultimate N Wifi Link 5300", not the most recent, but pretty common still ;)

On top of that, if I plug in the 2nd Wifi adapter, "iw list" will print all capabilities for BOTH adapters!

Attaching my iw list output for only the Intel adapter as reference.
BR/To

	max # scan SSIDs: 20
	max scan IEs length: 195 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Device supports RSN-IBSS.
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP-128 (00-0f-ac:4)
		* CCMP-256 (00-0f-ac:10)
		* GCMP-128 (00-0f-ac:8)
		* GCMP-256 (00-0f-ac:9)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * monitor
	Band 1:
		Capabilities: 0x107e
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT Max RX data rate: 450 Mbps
		HT TX/RX MCS rate indexes supported: 0-23
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps (short preamble supported)
			* 5.5 Mbps (short preamble supported)
			* 11.0 Mbps (short preamble supported)
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 2412 MHz [1] (15.0 dBm)
			* 2417 MHz [2] (15.0 dBm)
			* 2422 MHz [3] (15.0 dBm)
			* 2427 MHz [4] (15.0 dBm)
			* 2432 MHz [5] (15.0 dBm)
			* 2437 MHz [6] (15.0 dBm)
			* 2442 MHz [7] (15.0 dBm)
			* 2447 MHz [8] (15.0 dBm)
			* 2452 MHz [9] (15.0 dBm)
			* 2457 MHz [10] (15.0 dBm)
			* 2462 MHz [11] (15.0 dBm)
			* 2467 MHz [12] (15.0 dBm) (no IR)
			* 2472 MHz [13] (15.0 dBm) (no IR)
	Band 2:
		Capabilities: 0x107e
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			No RX STBC
			Max AMSDU length: 3839 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT Max RX data rate: 450 Mbps
		HT TX/RX MCS rate indexes supported: 0-23
		Bitrates (non-HT):
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 5180 MHz [36] (15.0 dBm) (no IR)
			* 5200 MHz [40] (15.0 dBm) (no IR)
			* 5220 MHz [44] (15.0 dBm) (no IR)
			* 5240 MHz [48] (15.0 dBm) (no IR)
			* 5260 MHz [52] (15.0 dBm) (no IR, radar detection)
			* 5280 MHz [56] (15.0 dBm) (no IR, radar detection)
			* 5300 MHz [60] (15.0 dBm) (no IR, radar detection)
			* 5320 MHz [64] (15.0 dBm) (no IR, radar detection)
			* 5500 MHz [100] (15.0 dBm) (no IR, radar detection)
			* 5520 MHz [104] (15.0 dBm) (no IR, radar detection)
			* 5540 MHz [108] (15.0 dBm) (no IR, radar detection)
			* 5560 MHz [112] (15.0 dBm) (no IR, radar detection)
			* 5580 MHz [116] (15.0 dBm) (no IR, radar detection)
			* 5600 MHz [120] (15.0 dBm) (no IR, radar detection)
			* 5620 MHz [124] (15.0 dBm) (no IR, radar detection)
			* 5640 MHz [128] (15.0 dBm) (no IR, radar detection)
			* 5660 MHz [132] (15.0 dBm) (no IR, radar detection)
			* 5680 MHz [136] (15.0 dBm) (no IR, radar detection)
			* 5700 MHz [140] (15.0 dBm) (no IR, radar detection)
			* 5745 MHz [149] (disabled)
			* 5765 MHz [153] (disabled)
			* 5785 MHz [157] (disabled)
			* 5805 MHz [161] (disabled)
			* 5825 MHz [165] (disabled)
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * start_ap
		 * new_station
		 * new_mpath
		 * set_mesh_config
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * set_tx_bitrate_mask
		 * frame
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * set_wds_peer
		 * probe_client
		 * set_noack_map
		 * register_beacons
		 * start_p2p_device
		 * set_mcast_rate
		 * connect
		 * disconnect
		 * set_qos_map
		 * set_multicast_to_unicast
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0x
b0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0
 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0
 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0
 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0
xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0
xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 
0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0
xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0x40 0xb0 0xc0 0xd0
		 * managed: 0x40 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * P2P-device: 0x40 0xd0
	software interface modes (can always be added):
		 * monitor
	interface combinations are not supported
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing
	Device supports TX status socket option.
	Device supports HT-IBSS.
	Device supports SAE with AUTHENTICATE command
	Device supports scan flush.
	Device supports per-vif TX power setting
	Driver supports full state transitions for AP/GO clients
	Driver supports a userspace MPM
	Device supports static SMPS
	Device supports dynamic SMPS
	Device supports configuring vdev MAC-addr on create.

@kueblc kueblc changed the title Ubuntu Bionic No error message printed when not using an AP supporting wifi card Jan 6, 2020
@kueblc
Copy link
Collaborator

kueblc commented Jan 6, 2020

Got it: if you just grep for "AP" in iw list it will find the string "AP" even though it's not supported by the adapter

How about iw list | grep -A 10 "Supported interface modes" | grep -e "\* AP$"?

On top of that, if I plug in the 2nd Wifi adapter, "iw list" will print all capabilities for BOTH adapters!

Yes, this is a known issue with how iw list works. I decided it was better to catch some bad configurations than none at all. If you know of a way to list the capabilities of only the specified interface, please let us know.

@tmuehlhoff
Copy link
Author

Yes, suggestion works well here, thanks for fixing....

The other thing: if the device is RFKILLED... you could run an rfkill unblock over it ?!

Or do you want me to file another ticket ?

@kueblc
Copy link
Collaborator

kueblc commented Jan 8, 2020

You do not need to file another ticket. A wifi device wouldn't normally be rfkilled, unless done explicitly by the user, in which case it would not be the responsibility of tuya-convert to change this. Can you explain why a device might be rfkilled without the user knowing?

@tmuehlhoff
Copy link
Author

well, MY device WAS rfkilled, the only thing I did is enable Ethernet in NetworkManager (which implicitly disables Wifi, thus rfkills it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants