PAB's blog - Tag - atheros2022-11-19T07:02:34+00:00urn:md5:5926f7e05a689ea9af53f3d15057feb6DotclearAtheros AR9271 and Debian Stretchurn:md5:a0ce8af5d16962bfc08cd4c69ea700a72018-04-17T21:31:00+02:002018-04-17T20:37:47+02:00Pierre-Alain Batheroslinuxudev <p>I was expecting an easy use of my brand new Wifi adapter AWUS036NHA under Debian Stretch but I hit an unexpected bug...</p>
<p>I started with</p>
<pre>
apt install firmware-atheros
</pre>
<p>and soon the blue LED on the Alfa device was blinking furiously. So good so far! But when I tried to connect to a Wifi network with Network-Manager the tool was unable to connect. And no matter what I did it failed to connect. This is what I could see in the system logs (<em>dmesg</em>):</p>
<pre>
[ 217.118991] usb 1-3: USB disconnect, device number 5
[ 219.137772] usb 1-3: new high-speed USB device number 6 using xhci_hcd
[ 219.294368] usb 1-3: New USB device found, idVendor=0cf3, idProduct=9271
[ 219.294373] usb 1-3: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 219.294376] usb 1-3: Product: UB91C
[ 219.294378] usb 1-3: Manufacturer: ATHEROS
[ 219.294380] usb 1-3: SerialNumber: 12345
[ 219.295099] usb 1-3: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
[ 219.295555] usb 1-3: firmware: direct-loading firmware ath9k_htc/htc_9271-1.4.0.fw
[ 219.578229] usb 1-3: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[ 219.829806] ath9k_htc 1-3:1.0: ath9k_htc: HTC initialized with 33 credits
[ 220.096217] ath9k_htc 1-3:1.0: ath9k_htc: FW Version: 1.4
[ 220.096221] ath9k_htc 1-3:1.0: FW RMW support: On
[ 220.096224] ath: EEPROM regdomain: 0x833a
[ 220.096225] ath: EEPROM indicates we should expect a country code
[ 220.096227] ath: doing EEPROM country->regdmn map search
[ 220.096229] ath: country maps to regdmn code: 0x37
[ 220.096231] ath: Country alpha2 being used: GB
[ 220.096232] ath: Regpair used: 0x37
[ 220.101582] ieee80211 phy1: Atheros AR9271 Rev:1
[ 220.115019] ath9k_htc 1-3:1.0 wlx00c0ca9751d9: renamed from wlan1
[ 220.148280] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 220.332215] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 220.578623] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 220.642308] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 255.566737] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 259.745782] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 259.986747] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 265.841754] IPv6: ADDRCONF(NETDEV_UP): wlx00c0ca9751d9: link is not ready
[ 276.133407] wlx00c0ca9751d9: authenticate with ec:08:6b:33:71:ba
[ 276.391552] wlx00c0ca9751d9: send auth to ec:08:6b:33:71:ba (try 1/3)
[ 276.394687] wlx00c0ca9751d9: authenticated
[ 281.389219] wlx00c0ca9751d9: aborting authentication with ec:08:6b:33:71:ba by local choice (Reason: 3=DEAUTH_LEAVING)
[ 282.900769] wlx00c0ca9751d9: authenticate with ec:08:6b:33:71:ba
[ 283.164429] wlx00c0ca9751d9: send auth to ec:08:6b:33:71:ba (try 1/3)
[ 283.167350] wlx00c0ca9751d9: authenticated
</pre>
<p><em>wlx00c0ca9751d9</em> is the name the system gave to the adapter and I was intrigued with this error line:</p>
<pre>
aborting authentication with ec:08:6b:33:71:ba by local choice (Reason: 3=DEAUTH_LEAVING)
</pre>
<p>After looking up on the web, I discovered that other users of Atheros firmware reported issue when the adapter was given a long name...</p>
<p>So I decided to teach udev to give a shorter name to the wifi device, for example wlan1. And by the way it would be easier to remember!</p>
<p>The first step was to detect the attributes seen by udev on the device. The right command to do so is:</p>
<pre>
udevadm info -a -p /sys/class/net/wlx00c0ca9751d9
</pre>
<p>Among many other attributes, I spotted quite precise ones:</p>
<pre>
ATTRS{manufacturer}=="ATHEROS"
ATTRS{product}=="UB91C"
</pre>
<p>Then I opened <em>/etc/udev/rules.d/70-persistent-net.rules</em> and added this line:</p>
<pre>
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTRS{manufacturer}=="ATHEROS", ATTRS{product}=="UB91C", NAME="wlan1"
</pre>
<p>After restarting udev with</p>
<pre>
/etc/init.d/udev restart
</pre>
<p>I unplugged and then plugged back the Wifi adapter and it was recognized as wlan1. And then the Wifi connection could be established.</p>
<p>Complicated but quite effective fix!</p>