How can I find the USB wireless adapter into the dmesg log file?

20,902

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.

Share:
20,902

Related videos on Youtube

AndreaNobili
Author by

AndreaNobili

Updated on September 18, 2022

Comments

  • AndreaNobili
    AndreaNobili over 1 year

    I am pretty new in Linux (RaspBian for RaspBerry Pi but I think that there are not difference) and I have to install an USB wireless network adapter (the product is the TP-Link TL-WN725N, this one: http://www.tp-link.it/products/details/?model=TL-WN725N )

    Now, I think that this is not automatically recognized by my system because if I execute ifconfig command I obtain the following output:

    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)
    

    So now it see only my ethernet network interface and not the wireless.

    So I was thinkig to try to see into the dmesg, but I don't know what have I to see and how to select it into the dmesg output.

    For example by the following command I can see the line of the dmesg log file relate to my ethernet port:

    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
    

    But what can I try to search for the USB wireless adapter?

    Tnx

    • Paul
      Paul almost 10 years
      The easiest way is to unplug it and plug it back in after booting. You'll lose your connection, but once you reconnect, you can dmesg and the last entries will be related to setting up the nic.
    • Cristian Ciupitu
      Cristian Ciupitu almost 10 years
      ifconfig -a shows all the interfaces. -a displays all interfaces which are currently available, even if down. Also ifconfig is deprecated and ip link is recommended.
  • AndreaNobili
    AndreaNobili almost 10 years
    Perfect explaination !!! You have give me some great informations about how Linux work !!! Tnx so much