Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ways to enumerate wireless interfaces
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Mon Nov 13, 2017 5:19 pm    Post subject: Ways to enumerate wireless interfaces Reply with quote

Hello everyone. I have an issue to show all wireless interfaces, but I wouldn't like to use iw utility. I found information about lshw utility and I believe it's working well, but on my laptop I have the following output:

Code:

  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: enp2s0
       version: 07
       serial: bc:ee:7b:96:a6:f6
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl8168e-3_0.0.4 03/27/12 latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: irq:27 ioport:d000(size=256) memory:f2104000-f2104fff memory:f2100000-f2103fff
  *-network
       description: Ethernet interface
       product: AR9485 Wireless Network Adapter
       vendor: Qualcomm Atheros
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlp3s0
       version: 01
       serial: 24:fd:52:14:8a:cd
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list rom ethernet physical
       configuration: broadcast=yes driver=ath9k driverversion=4.12.12-gentoo firmware=N/A ip=10.100.3.4 latency=0 link=yes multicast=yes
       resources: irq:17 memory:f7800000-f787ffff memory:f7880000-f788ffff


The problem is only one: why this utility says me a Qualcomm Atheros Wireless Network Adapter is an Ethernet interface?

So please tell me how could I show all wireless interfaces correctly without iw utility?

Takk
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Mon Nov 13, 2017 5:25 pm    Post subject: Reply with quote

g-virus,

WiFi is Ethernet over a radio link.
Once the radio link has been established, all the standard wired tools work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Mon Nov 13, 2017 6:10 pm    Post subject: Reply with quote

NeddySeagoon wrote:
g-virus,

WiFi is Ethernet over a radio link.
Once the radio link has been established, all the standard wired tools work.


That's perfect, but before the wired tools are needed to use, the radio link have to be established therefore an identification an interface type is needed. For example, I don't need to run wpa_supplicant on wired ethernet interface, right?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Mon Nov 13, 2017 8:23 pm    Post subject: Reply with quote

g-virus,

You can 'up' the interface and look for wireless extensions.

Check dmesg for interfaces of the form wlanX.
Thats the kernel name, before udev renames the interfaces.
However, that needs the driver correctly installed.

I don't know a way to parse lspci, dmidecode and others to reliably determine if an interface is hardware.
Other than dmidecode, which reads the BIOS, the other tools read the Vendor and Device IDs and produce friendly text output using a look up table.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Nov 14, 2017 5:27 pm    Post subject: Re: Ways to enumerate wireless interfaces Reply with quote

g-virus wrote:
So please tell me how could I show all wireless interfaces correctly without iw utility?

g-virus ... you can parse '/sys/class/net/', eg (using zsh):

Code:
# print -rl /sys/class/net/wl*(:t)
wlan0

for bash something like the following should suffice:

Code:
#!/bin/bash
set -e
wdev=($(ls -d /sys/class/net/wl*))
devs=(${wdev[@]##*/})
echo "${devs[@]}"

HTH & best ... khay
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Tue Nov 14, 2017 6:08 pm    Post subject: Reply with quote

khayyam,

Does that need kernel support?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Nov 14, 2017 8:11 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Does that need kernel support?

Neddy ... you mean the specific drivers for the specific interfaces? Yes, but that is the case when using 'ifconfig up', 'dmesg', or similar. As I understood the question it was "how could I show all wireless interfaces correctly without iw utility", and I assumed that "interface" means usable interfaces.

best ... khay
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Sun Nov 19, 2017 11:43 pm    Post subject: Re: Ways to enumerate wireless interfaces Reply with quote

khayyam wrote:
g-virus wrote:
So please tell me how could I show all wireless interfaces correctly without iw utility?

g-virus ... you can parse '/sys/class/net/', eg (using zsh):

Code:
# print -rl /sys/class/net/wl*(:t)
wlan0

for bash something like the following should suffice:

Code:
#!/bin/bash
set -e
wdev=($(ls -d /sys/class/net/wl*))
devs=(${wdev[@]##*/})
echo "${devs[@]}"

HTH & best ... khay


Hello. Thank you for the answer. Are you sure udev is always gets wl* names to the wireless interfaces? If yes so yours variant is the easiest. If not - I guess, the Neddy's offer to check wireless extensions is better isn't?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Nov 20, 2017 12:33 am    Post subject: Re: Ways to enumerate wireless interfaces Reply with quote

g-virus wrote:
Hello. Thank you for the answer. Are you sure udev is always gets wl* names to the wireless interfaces? If yes so yours variant is the easiest. If not - I guess, the Neddy's offer to check wireless extensions is better isn't?

g-virus ... you're welcome. Yes, 'wl' corresponds with the "two character prefix" systemd-udev uses for wireless device naming. I expect that sys-fs/eudev uses the same, as it similarly supports predicatable device naming (as I remember this was introduced around 197).

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum