[PATCH] linux: check the prefix 'wlan' for WiFi device as the last fallback method



The sysfs path may not exist due to race conditions while accessing sysfs.

It's better to check the prefix 'wlan' as the last fallback method.

For example, 'wlan0' has been renamed to 'wlp1s0', but it's still checking
'wlan0' above so it will always fail.

You can see this problem below.

  Nov 28 06:22:36 u-Precision-5520 kernel: ath10k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <trace> [1480332156.5568] platform-linux: 
event-notification: NEWLINK, seq 0: 2: wlan0 <DOWN;broadcast,multicast> mtu 1500 arp 1 ethernet? not-init 
addrgenmode eui64 addr 40:49:0F:8A:E5:97
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <debug> [1480332156.5568] platform: signal: link   
added: 2: wlan0 <DOWN;broadcast,multicast> mtu 1500 arp 1 ethernet? not-init addrgenmode eui64 addr 
40:49:0F:8A:E5:97 driver unknown
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <warn>  [1480332156.5569] device (wlan0): failed to 
find device 2 'wlan0' with udev
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <info>  [1480332156.5569] device (wlan0): driver 
'(null)' does not support carrier detection.
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <debug> [1480332156.5569] device[0xab4b80] (wlan0): 
constructed (NMDeviceEthernet)
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <debug> [1480332156.5569] device[0xab4b80] (wlan0): 
start setup of NMDeviceEthernet, kernel ifindex 2
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <debug> [1480332156.5570] platform-linux: error 
reading /sys/class/net/wlan0/phys_port_id: Failed to open file '/sys/class/net/wlan0/phys_port_id': No such 
file or directory
  Nov 28 06:22:36 u-Precision-5520 NetworkManager[772]: <debug> [1480332156.5570] platform-linux: error 
reading /sys/class/net/wlan0/dev_id: Failed to open file '/sys/class/net/wlan0/dev_id': No such file or 
directory

After the device type is decided as NM_LINK_TYPE_ETHERNET, there is no way back
unless NetworkManager will check all device types again, but it won't do that.

Shih-Yuan Lee (FourDollars) (1):
  linux: check the prefix 'wlan' for WiFi device as the last fallback

 src/platform/wifi/wifi-utils.c | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.7.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]