Как найти беспроводной адаптер USB в файле журнала dmesg?

12253
AndreaNobili

Я довольно новичок в Linux (RaspBian для RaspBerry Pi, но я думаю, что нет никакой разницы), и я должен установить адаптер беспроводной сети USB (продукт TP-Link TL-WN725N, вот этот: http: // www .tp-link.it / products / details /? model = TL-WN725N )

Теперь я думаю, что это не распознается моей системой автоматически, потому что, если я выполню команду ifconfig, я получу следующий вывод:

pi@raspberrypi ~ $ ifconfig eth0 Link encap:Ethernet HWaddr b8:27:eb:2a:9f:b0  inet addr:192.168.1.8 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:475 errors:0 dropped:0 overruns:0 frame:0 TX packets:424 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000  RX bytes:34195 (33.3 KiB) TX bytes:89578 (87.4 KiB)  lo Link encap:Local Loopback  inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 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:0  RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 

Так что теперь он видит только мой сетевой интерфейс Ethernet, а не беспроводной.

Так что я подумал попытаться заглянуть в dmesg, но я не знаю, что мне увидеть и как выбрать его в вывод dmesg.

Например, с помощью следующей команды я вижу строку файла журнала dmesg, относящуюся к моему порту Ethernet:

pi@raspberrypi ~ $ cat /var/log/dmesg |grep -i eth [ 3.177620] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:2a:9f:b0 [ 18.030389] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup [ 19.642167] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1 

Но что я могу попробовать найти беспроводной адаптер USB?

Tnx

1
Самый простой способ - отключить его и снова подключить после загрузки. Вы потеряете соединение, но после повторного подключения вы можете `dmesg`, и последние записи будут связаны с настройкой имени. Paul 9 лет назад 0
`ifconfig -a` показывает все интерфейсы. `-a` отображает все доступные в данный момент интерфейсы, даже если они недоступны. Также ifconfig устарела и рекомендуется `ip link`. Cristian Ciupitu 9 лет назад 0

1 ответ на вопрос

5
MariusMatutiae

There are many useful commands. First is lsusb, which lists all connected usb devices. You should see there your usb adapter.

Second is lspci, showing all devices connected to the PCI bus. In my case, for instance, I obtain (restricting the output to network devices only):

 $ lspci -vnn | grep -i net 00:19.0 Ethernet controller [0200]: Intel Corporation 82579LM Gigabit Network Connection [8086:1502] (rev 04) 04:00.0 Network controller [0280]: Intel Corporation Centrino Advanced-N 6235 [8086:088e] (rev 24) 

This shows the all-important code of your wifi card, [8086:088e] in my case.

Then you search for this code in Wikidevi: the page it finds says that the driver for my wireless card is iwlwifi in my case. It is important you use the code in square parentheses above, because producers often have several versions of a wifi adapter with different chips, sometimes even from different manufacturers (!!!) requiring different drivers. Thus the only certain way to identify your driver does not involve the adapter's name, but its code.

Now that we know the driver's name we first check whether we have it,

 modinfo iwlwifi 

If there is some output, we have it. Then we check that it really is suited to my card, as follows:

 $ modinfo iwlwifi | grep 8086 | grep 088E alias: pci:v00008086d0000088Esv*sd00004860bc*sc*i* alias: pci:v00008086d0000088Esv*sd0000446Abc*sc*i* alias: pci:v00008086d0000088Esv*sd00004460bc*sc*i* alias: pci:v00008086d0000088Esv*sd0000406Abc*sc*i* alias: pci:v00008086d0000088Esv*sd00004060bc*sc*i* 

This shows that my driver has several lines (corresponding to several different versions of my wifi adapter) for my card's Vendor code V8086 and Device code d088E. Notice that in this case you must use capital letters, E in my case. So this driver is indeed suited to my adapter.

Then, we check whether it is correctly mounted:

 sudo lshw -C network 

The output is longish (it involves ethernet card, 3G card, ...) but the relevant part is:

 *-network description: Wireless interface product: Centrino Advanced-N 6235 vendor: Intel Corporation physical id: 0 bus info: pci@0000:04:00.0 logical name: wlan0 version: 24 serial: c8:f7:33:4c:cc:e1 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=3.13.0-27-generic firmware=18.168.6.1 latency=0 link=no multicast=yes wireless=IEEE 802.11abgn resources: irq:47 memory:e2500000-e2501fff 

Here you see that it says driver=iwlwifi and firmware=.... Thus the correct driver and firmware have been loaded into the kernel. Everything works fine, in my case.

Lastly, we may check whether the adapter is up or down: from the previous output you see that my wifi card is given physical name 0 (corresponding to phy0) and logical name wlan0. I can search for its current status by means of

 $ ip link list dev wlan0 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000 link/ether c8:f7:33:4c:cc:e1 brd ff:ff:ff:ff:ff:ff 

which clearly states it is UP. If it didn't, this command

 sudo ip link set dev wlan0 up 

would bring it up.

If all of this has been checked and is ok but your wifi still does not work, you can get useful info from the command:

 dmesg | grep wlan0 

or wlan1 or whatever your wifi card is called.

You can go through the same steps, and see what is missing in your case.

Идеальное объяснение !!! Вы дали мне отличную информацию о том, как работает Linux !!! Тнкс так много AndreaNobili 9 лет назад 0