我是 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允许我将其打开。