我是 Linux 新手,所以感謝您的幫助。這款 WiFi 適配器在 BeagleBone/Raspberry Pi 領域並不常用,但它很有用,因為它允許我連接自訂定向天線,以便與 BeagleBone 進行長距離通訊。
開始:
我可以透過 USB 介面和 ssh 連接到 beaglebone,以 root 身分輕鬆登入。當我輸入時,sudo cat /var/log/messages
我得到下面的輸出(部分),這表示 usb1-1 已連接到 USB WiFi 適配器。事實上,該 USB WiFi 設備使用的晶片組是 Realtek RTL8187。
我了解到 Ubuntu 提供了該 Realtek 晶片的驅動程式作為標準,但我知道 Beaglebone 使用不同類型的 Linux。
我怎麼能診斷系統並連接到我的 wifi 網絡,如果不能,我怎麼能獲得這個驅動程式並繼續?該驅動程式可能與 Ubuntu 用於 Realtek 8187 晶片的驅動程式相同。
另外——我聽過一種叫做「網路管理員」的東西——這是我需要開始使用的東西嗎?如果是這樣,我如何在這個嵌入式Linux系統上透過終端下載並安裝它?
Apr 23 20:24:04 beaglebone systemd-logind[700]: Linked /tmp/.X11-unix/X0 to /run/user/debian/X11-display.
Apr 23 20:24:07 beaglebone systemd[1]: Startup finished in 2s 663ms 344us (kernel) + 14s 900ms 121us (userspace) = 17s 563ms 465us.
Apr 23 20:24:14 beaglebone kernel: [ 25.164174] net eth0: initializing cpsw version 1.12 (0)
Apr 23 20:24:14 beaglebone kernel: [ 25.168656] net eth0: phy found : id is : 0x7c0f1
Apr 23 20:24:14 beaglebone kernel: [ 25.190080] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Apr 23 20:44:41 beaglebone kernel: [ 1251.610969] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
Apr 23 20:44:41 beaglebone kernel: [ 1251.611096] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Apr 23 20:44:55 beaglebone kernel: [ 1265.814467] net eth0: initializing cpsw version 1.12 (0)
Apr 23 20:44:55 beaglebone kernel: [ 1265.817260] net eth0: phy found : id is : 0x7c0f1
Apr 23 20:44:55 beaglebone kernel: [ 1265.833067] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Apr 23 20:44:55 beaglebone kernel: [ 1266.187458] net eth0: initializing cpsw version 1.12 (0)
Apr 23 20:44:55 beaglebone kernel: [ 1266.190295] net eth0: phy found : id is : 0x7c0f1
Apr 23 20:44:55 beaglebone kernel: [ 1266.205991] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Apr 23 20:44:57 beaglebone kernel: [ 1268.197080] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
Apr 23 20:44:57 beaglebone kernel: [ 1268.197237] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Oct 15 03:24:43 beaglebone kernel: [ 1528.071391] usb 1-1: new high-speed USB device number 2 using musb-hdrc
Oct 15 03:24:43 beaglebone kernel: [ 1528.197461] usb 1-1: New USB device found, idVendor=0bda, idProduct=8187
Oct 15 03:24:43 beaglebone kernel: [ 1528.197501] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 15 03:24:43 beaglebone kernel: [ 1528.197536] usb 1-1: Product: RTL8187_Wireless
Oct 15 03:24:43 beaglebone kernel: [ 1528.197570] usb 1-1: Manufacturer: Manufacturer_Realtek_RTL8187_
Oct 15 03:24:43 beaglebone kernel: [ 1528.197603] usb 1-1: SerialNumber: 00C0CA6D703D
Oct 15 03:24:44 beaglebone kernel: [ 1528.378502] cfg80211: Calling CRDA to update world regulatory domain
Oct 15 03:24:44 beaglebone kernel: [ 1528.812425] ieee80211 phy0: hwaddr 00:c0:ca:6d:70:3d, RTL8187vB (default) V1 + rtl8225z2, rfkill mask 2
Oct 15 03:24:44 beaglebone kernel: [ 1528.829906] rtl8187: Customer ID is 0xFF
Oct 15 03:24:44 beaglebone kernel: [ 1528.852966] rtl8187: wireless switch is on
Oct 15 03:24:44 beaglebone kernel: [ 1528.853874] usbcore: registered new interface driver rtl8187
當我輸入 ifup wlan0 時,我得到:
root@beaglebone:/# ifup wlan0
Ignoring unknown interface wlan0=wlan0
當我輸入 iwconfig 時,我得到:
root@beaglebone:/# iwconfig
wlan0 IEEE 802.11bg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
lo no wireless extensions.
eth0 no wireless extensions.
usb0 no wireless extensions.
root@beaglebone:/#
我很感激任何幫助。我認為這個答案對我和其他嘗試使用這種 USB WiFi 和 BeagleBone 的人都有幫助。
更新:我從中學到了一點這裡並透過 編輯了我的介面文件sudo nano /etc/network/interfaces
。我取消註釋了 wifi 部分..添加了網絡名稱和密碼...然後見下文。有什麼想法嗎?
root@beaglebone:/# ifup wlan0
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/00:c0:ca:6d:70:3d
Sending on LPF/wlan0/00:c0:ca:6d:70:3d
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
receive_packet failed on wlan0: Network is down
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.594437] Internal error: Oops: 817 [#1] SMP THUMB2
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.676479] Process wpa_supplicant (pid: 2276, stack limit = 0xd5988240)
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.683943] Stack: (0xd5989da8 to 0xd598a000)
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.688819] 9da0: d5a3f520 00000000 11111111 d5989da8 d5a3f50c d5924548
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.697880] 9dc0: d5a3f500 d5924000 00008914 d5ac680c d5ac6800 c045a3db d5a3e400 bf9dc255
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.706919] 9de0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.715986] 9e00: d5a3f50c 00000000 00000000 d5a3e400 d5924548 00000000 d5924000 00008914
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.725032] 9e20: d5ac680c d5ac6800 00000000 bf958b2b 0000000d 00000000 00000001 00000000
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.734092] 9e40: d5ac680c d5924000 bf981034 00000000 d592402c 00008914 d5ac680c d5ac6800
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.743128] 9e60: 00000000 bf9591ff d5924000 c03bfd63 c03bfd03 d5924000 00001003 00001002
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.752177] 9e80: 00000001 c03bfeed 00008914 d5924000 00001002 d5924000 bea2aa54 c03bffa9
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.761223] 9ea0: 00000000 00000001 d5924000 c03f87a1 00000000 01000000 6e616c77 00000030
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.770279] 9ec0: 00000000 00000000 00001003 00000000 00000000 00000000 00000000 00008914
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.779332] 9ee0: bea2aa54 c081c740 d5060e40 00000007 00000000 00000000 00000005 c03b1cfd
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.788405] 9f00: c03b1bb1 d5060e60 bea2aa54 d5957800 00000007 c00b36ab d5060220 c00b58bf
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.797422] 9f20: d5150f60 00000000 d5150f60 00000000 d5150fb4 c00b5d13 00002710 d5904b40
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.806479] 9f40: 00000000 d5060c80 00000000 bea2a914 00000129 c000c1c4 d5988000 d5957800
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.815514] 9f60: 00000000 bea2aa54 00008914 00000007 00000000 00000000 00000005 c00b3727
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.824556] 9f80: 00000007 00000000 bea2aa54 000a5ae0 00000001 00000007 00000036 c000c1c4
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.833563] 9fa0: d5988000 c000c021 000a5ae0 00000001 00000007 00008914 bea2aa54 00001003
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.842606] 9fc0: 000a5ae0 00000001 00000007 00000036 00000007 bea2ab4c 000a5ae0 00000005
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.851646] 9fe0: 000a85c4 bea2aa50 0006a87b b6ce1f6c 60000010 00000007 00000000 00000000
Message from syslogd@beaglebone at Oct 15 04:05:13 ...
kernel:[ 3957.985588] Code: 61a2 f8cd 8000 9301 (601a) 9702
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
send_packet: Network is down
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
send_packet: Network is down
^Xc^Z
[1]+ Stopped ifup wlan0
現在,這次我輸入ifconfig wlan0
(到達某個地方):
root@beaglebone:~# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 00:c0:ca:6d:70:3d
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
現在根據提示嘗試了這個這裡:
root@beaglebone:~# ip link set wlan0 up
RTNETLINK answers: Operation not possible due to RF-kill
root@beaglebone:~#
現在嘗試解決這個基於 RF-kill 的錯誤這餵養。
呃——我被「硬封鎖」了
root@beaglebone:~# rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
root@beaglebone:~#
答案1
最後,感謝 Dbo 的幫助,這一切變得非常簡單。我無法確認 wpa_supplicant 是否是這項工作所必需的,因為在它開始工作時我已經安裝了它 ( aptitude install wpasupplicant
)。
這就是我所做的:
1. 須藤納米 /etc/network/interfaces
- 編輯 WiFi 範例部分,刪除註釋
- 添加allow-hotplug wlan0(或確保它存在且未註釋)
- 保留 auto wlan0 註釋(感謝 Dbo 的建議)
- 以純文字形式新增您的無線網路名稱 (wpa-ssid)
- 以純文字形式加入密碼 (wpa-psk)
2.重啟(可選,但由於某種原因我不得不這樣做,並且它在所有後續重新啟動中都有效)
3、iwconfig
這關聯最終提供了很多有用的信息,但出於某種原因我不需要輸入ip a
, ip link set wlan0 up
。我無法確認這是因為我之前已經這樣做過還是因為它「有效」。現在,每次 BeagleBone 啟動時,它都會自動偵測 WiFi 網路。我打字curl www.google.com
確認。
更新:所以,我想測試 ip link set wlan0 up/down 問題。要關閉它,無論出於何種原因,您都需要將其設定為關閉兩次。這將關閉加密狗的藍光。將 wlan0 設定回 up 會將其恢復,並自動連接到網路(閃爍)。
然後,為了進一步測試,我將 wlan0 設定為關閉並重新啟動。這次重新啟動時,USB 轉接器指示燈短暫閃爍然後就離開了。當我嘗試輸入, 和
時發現之前的“硬塊”又回來了。ip link set wlan0 up
rfkill list all
我重新啟動了 BeagleBone,這個問題就消失了。
所以:總結一下更新,不要在 wlan0 關閉的情況下關閉它,如果您這樣做,您可能需要將 wlan0 設定為啟動(這會失敗),然後重新啟動。
最後,請注意,這款 WiFi USB 加密狗在運作時很熱!它的優點在於它有一個強大的天線,您可以將其更換為定制天線,但它的溫度至少比 BeagleBone 本身高 5 倍,這意味著浪費了幾瓦的熱量。由於我將使用它進行遠端太陽能電池供電設置,因此我需要學習如何可靠地打開和關閉此 WiFi 適配器。我不確定是否ip link set wlan0 down
夠好。事實上,該命令適用於斷開連接,導致 USB 加密狗上的藍色狀態燈常亮(之前閃爍),但功耗仍有待測試(目前將透過產生的熱量進行測試)。
UPDATE2:由於某種原因,這一切都停止了。我最終需要使用命令 ifup (我認為是 wpa_supplicant 的一部分)。 ifup wlan0、ifdown wlan0、ifquery ...等最後ifdown -a(全部關閉)關閉所有內容,而ifup wlan0允許我將其打開。