Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Quick Mesh Project
qMp packages
Commits
2992b18f
Commit
2992b18f
authored
Apr 23, 2013
by
Simó Albert i Beltran
Browse files
Configure wifi devices with MAC address of physical device, closes #229.
parent
aaba5ee6
Changes
1
Hide whitespace changes
Inline
Side-by-side
packages/qmp-system/files/etc/qmp/qmp_common.sh
View file @
2992b18f
...
@@ -181,8 +181,17 @@ qmp_get_wifi_devices() {
...
@@ -181,8 +181,17 @@ qmp_get_wifi_devices() {
}
}
# Returns the MAC address of the wifi devices
# Returns the MAC address of the wifi devices
# (get MAC addres of the physical wifi device, if exists)
qmp_get_wifi_mac_devices
()
{
qmp_get_wifi_mac_devices
()
{
echo
"
$(
ip
link
|
grep
-A1
-E
": (wifi|wlan).: "
|
grep link
|
cut
-d
' '
-f6
)
"
for
device
in
$(
qmp_get_wifi_devices
)
do
if
[
-s
"/sys/class/net/
$device
/phy80211/macaddress"
]
then
cat
"/sys/class/net/
$device
/phy80211/macaddress"
else
qmp_get_mac_for_dev
$device
fi
done
}
}
# Returns the device name that corresponds to the MAC address
# Returns the device name that corresponds to the MAC address
...
@@ -202,9 +211,14 @@ qmp_get_mac_for_dev() {
...
@@ -202,9 +211,14 @@ qmp_get_mac_for_dev() {
# Returns the mac addres for specific device,, only wifi devs are allowed. Useful when eth and wlan have same MAC
# Returns the mac addres for specific device,, only wifi devs are allowed. Useful when eth and wlan have same MAC
# qmp_get_dev_from_wifi_mac 00:22:11:33:44:55
# qmp_get_dev_from_wifi_mac 00:22:11:33:44:55
qmp_get_dev_from_wifi_mac
()
{
qmp_get_dev_from_wifi_mac
()
{
mac
=
"
$(
ip
link
|
grep
-A1
-E
": (wifi|wlan|wl).: "
|
grep
-i
$1
-B1
|
cut
-d
' '
-f2
|
tr
-d
"
\n
"
,:
)
"
for
device
in
$(
qmp_get_wifi_devices
)
[
-z
"
$mac
"
]
&&
mac
=
"00:00:00:00:00:00"
do
echo
"
$mac
"
if
grep
-q
-i
"^
$1
$"
"/sys/class/net/
$device
/phy80211/macaddress"
"/sys/class/net/
$device
/address"
2> /dev/null
then
echo
$device
return
fi
done
}
}
#########################
#########################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment