Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
intel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Feed
intel
Commits
05b991ba
Commit
05b991ba
authored
6 years ago
by
Anjan Chanda
Browse files
Options
Downloads
Patches
Plain Diff
wifi: add wifi configuration script for intel
parent
5c413a12
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lq-wave-300_5_x/files/lib/wifi/intel.sh
+167
-0
167 additions, 0 deletions
lq-wave-300_5_x/files/lib/wifi/intel.sh
with
167 additions
and
0 deletions
lq-wave-300_5_x/files/lib/wifi/intel.sh
0 → 100644
+
167
−
0
View file @
05b991ba
#!/bin/sh
append DRIVERS
"intel"
HARDWARE
=
$(
db
-q
get hw.board.hardware
)
BASEMAC
=
$(
db
-q
get hw.board.BaseMacAddr
)
BASEMAC
=
${
BASEMAC
//
:/
}
ssid
=
"
$HARDWARE
-
$BASEMAC
"
key
=
"1234567890"
encryption
=
"psk2"
wifi_interface_is_ap
()
{
iw dev
${
1
}
info |
grep
-q
'type AP'
}
wifi_device_get_macaddress
()
{
local
phydev
=
$1
local
netdev
=
$2
echo
$(
cat
/sys/class/ieee80211/
$phydev
/device/net/
$netdev
/address
)
}
wifi_device_get_intparam
()
{
local
phydev
=
$1
local
netdev
=
$2
local
param
=
$3
out
=
$(
iw dev
$netdev
iwlwav
$param
)
[
"
$?
"
==
"0"
]
&&
{
echo
$out
|
tr
-d
'A-Za-z:'
}
}
wifi_get_radio_netdev
()
{
local
phy
=
$1
for
_netdev
in
/sys/class/ieee80211/
${
phy
}
/device/net/
*
;
do
[
-e
"
$_netdev
"
]
||
continue
netdev
=
"
${
_netdev
##*/
}
"
echo
"
$netdev
"
&&
return
done
}
check_phypath
()
{
local
path
config_get path
$1
path
[
-n
"
$path
"
]
&&
[
"
$path
"
==
"
$2
"
]
&&
{
found_phypath
=
1
}
return
0
}
detect_intel_interfaces
()
{
local
phyname
=
$1
local
radio
=
$2
for
_vif
in
/sys/class/ieee80211/
${
1
}
/device/net/
*
;
do
[
-e
"
$_vif
"
]
||
{
continue
}
vif
=
"
${
_vif
##*/
}
"
wifi_interface_is_ap
$vif
[
"
$?
"
==
"0"
]
||
{
continue
}
hidden
=
$(
wifi_device_get_intparam
$phyname
$vif
gHiddenSSID
)
apfwd
=
$(
wifi_device_get_intparam
$phyname
$vif
gAPforwarding
)
[
"
$apfwd
"
==
"0"
]
&&
isolate
=
1
||
isolate
=
0
uci
-q
add wireless wifi-iface
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.device
=
${
radio
}
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.ifname
=
${
vif
}
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.mode
=
ap
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.network
=
lan
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.ssid
=
${
ssid
}
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.hidden
=
${
hidden
}
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.isolate
=
${
isolate
}
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.encryption
=
${
encryption
}
uci
-q
set
wireless.@wifi-iface[
${
ifidx
}
]
.key
=
${
key
}
uci
-q
commit wireless
ifidx
=
$((
$ifidx
+
1
))
done
}
detect_intel
()
{
devidx
=
0
ifidx
=
0
config_load wireless
for
_dev
in
/sys/class/ieee80211/
*
;
do
[
-e
"
$_dev
"
]
||
continue
dev
=
"
${
_dev
##*/
}
"
radioname
=
$(
wifi_get_radio_netdev
${
dev
}
)
mode_band
=
"g"
channel
=
"11"
htmode
=
""
ht_capab
=
""
iw phy
"
$dev
"
info |
grep
-q
'Capabilities:'
&&
htmode
=
HT20
iw phy
"
$dev
"
info |
grep
-q
'2412 MHz'
||
{
mode_band
=
"a"
;
channel
=
"36"
;
}
vht_cap
=
$(
iw phy
"
$dev
"
info |
grep
-c
'VHT Capabilities'
)
cap_5ghz
=
$(
iw phy
"
$dev
"
info |
grep
-c
"Band 2"
)
[
"
$vht_cap
"
-gt
0
-a
"
$cap_5ghz
"
-gt
0
]
&&
{
mode_band
=
"a"
;
channel
=
"36"
htmode
=
"VHT80"
}
[
-n
"
$htmode
"
]
&&
ht_capab
=
"set wireless.
${
radioname
}
.htmode=
$htmode
"
if
[
-x
/usr/bin/readlink
-a
-h
/sys/class/ieee80211/
${
dev
}
]
;
then
path
=
"
$(
readlink
-f
/sys/class/ieee80211/
${
dev
}
/device
)
"
else
path
=
""
fi
if
[
-n
"
$path
"
]
;
then
path
=
"
${
path
##/sys/devices/
}
"
case
"
$path
"
in
platform
*
/pci
*
)
path
=
"
${
path
##platform/
}
"
;;
esac
dev_id
=
"set wireless.
${
radioname
}
.path='
$path
'"
else
dev_id
=
"set wireless.
${
radioname
}
.macaddr=
$(
cat
/sys/class/ieee80211/
${
dev
}
/macaddress
)
"
fi
found_phypath
=
0
config_foreach check_phypath wifi-device
$path
[
$found_phypath
-gt
0
]
&&
{
devidx
=
$((
$devidx
+
1
))
continue
}
macaddr
=
$(
wifi_device_get_macaddress
$dev
$radioname
)
beacon_int
=
$(
wifi_device_get_intparam
$dev
$radioname
gBeaconPeriod
)
country_ie
=
$(
wifi_device_get_intparam
$dev
$radioname
g11dActive
)
[
"
$country_ie
"
==
"1"
]
&&
{
country
=
"EU"
## FIXME
}
uci
-q
batch
<<-
EOF
set wireless.
${
radioname
}
=wifi-device
set wireless.
${
radioname
}
.type=intel
set wireless.
${
radioname
}
.channel=
${
channel
}
set wireless.
${
radioname
}
.hwmode=11
${
mode_band
}
set wireless.
${
radioname
}
.macaddr=
${
macaddr
}
set wireless.
${
radioname
}
.beacon_int=
${
beacon_int
}
set wireless.
${
radioname
}
.country=
${
country
}
set wireless.
${
radioname
}
.country_ie=
${
country_ie
}
${
dev_id
}
${
ht_capab
}
set wireless.
${
radioname
}
.disabled=1
EOF
uci
-q
commit wireless
config_load wireless
detect_intel_interfaces
$dev
$radioname
$ifidx
devidx
=
$((
$devidx
+
1
))
done
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment