AdHoc can not directly work that ways…
Find in source code, it must have CONFIG_STA_SUPPORT then you can enable that “NetworkType” setting.
But this driver do not support that mode I guess.
Have to check the source code again. There should be a way to enable it. :p
Author Archives: vonger
VoCore2: WiFi modes(ADHOC)
Just find some instruction to use the mt7628 driver by iwpriv, this still need work to make it work with uci system, but at least if you are using latest vocore2 wifi driver, you can start adhoc mode by iwpriv. 🙂
a> Config STA to link with AP which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID=”AP’s SSID”
b> Config STA to link with AP which is SHARED/WEP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=SHARED
3. iwpriv ra0 set EncrypType=WEP
4. iwpriv ra0 set DefaultKeyID=1
5. iwpriv ra0 set Key1=”AP’s wep key”
6. iwpriv ra0 set SSID=”AP’s SSID”
c> Config STA to link with AP which is WPAPSK/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPAPSK
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=”AP’s wpa-preshared key”
6. iwpriv ra0 set SSID=”AP’s SSID”
d> Config STA to link with AP which is WPAPSK/AES(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPAPSK
3. iwpriv ra0 set EncrypType=AES
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=”AP’s wpa-preshared key”
6. iwpriv ra0 set SSID=”AP’s SSID”
e> Config STA to link with AP which is WPA2PSK/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPA2PSK
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=12345678
6. iwpriv ra0 set SSID=”AP’s SSID”
f> Config STA to create/link as adhoc mode, which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Adhoc
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID=”Adhoc’s SSID”
g> Config STA to create/link as adhoc mode, which is WPANONE/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Adhoc
2. iwpriv ra0 set AuthMode=WPANONE
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID=”AP’s SSID”
5. iwpriv ra0 set WPAPSK=12345678
6. iwpriv ra0 set SSID=”AP’s SSID”
VoCore2: Monitor/Sniffer on WiFi
It is pretty simple by using mt7628.ko(or directly use firmware http://vonger.cn/misc/vocore2/20180419V.bin)
First install libpcap.ipk and tcpdump.ipk
Then MonitorMode=2 is MONITOR_MODE_FULL, =1 is MONITOR_MODE_REGULAR_RX, =0 is OFF.
ifconfig mon0 up iwpriv ra0 set MonitorMode=2 tcpdump -i mon0 -w /tmp/store.cap -vv
or tcpdump -i ra0 -w /tmp/store.cap -vv
The raw data is saved to /tmp/store.cap.
Now we can use wireshark to read store.cap, check the data we get from net. 🙂
PS: CMCC-XXX is everywhere, noise…
VoCore2: Show Multiple SSIDs(up to 16 SSID)
Today when I hack the mt7628 driver, I find this hidden feature( maybe not hidden, but at least no documentation at all )
Example come first, if we want 4 different SSIDs in same VoCore2, need to setting up /etc/wireless/mt7628/mt7628.dat
This is only works for mediatek wifi driver mt7628.ko, not sure if mt76 works.
Modify BssidNum, set it to 4.
BssidNum=4
SSID1=VoCore2
SSID2=VoCore2-GUEST
SSID3=VoCore2-HOST
SSID4=VoCore2-NAS
Then reboot, you will find four raX device in your device list.
ra1 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char br-lan no private ioctls. mon0 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char ra2 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char lo no private ioctls. eth0.1 no private ioctls. apcli0 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char ra3 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char ra0 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char eth0 no private ioctls. eth0.2 no private ioctls. apcli1 Available private ioctls : set (8BE2) : set 1536 char & get 0 show (8BF1) : set 1024 char & get 0 get_site_survey (8BED) : set 0 & get 1024 char set_wsc_oob (8BF9) : set 1024 char & get 1024 char get_mac_table (8BEF) : set 1024 char & get 1024 char e2p (8BE7) : set 1024 char & get 1024 char bbp (8BE3) : set 1024 char & get 1024 char mac (8BE5) : set 1024 char & get 1024 char rf (8BF3) : set 1024 char & get 1024 char get_wsc_profile (8BF2) : set 1024 char & get 1024 char get_ba_table (8BF6) : set 1024 char & get 1024 char stat (8BE9) : set 1024 char & get 1024 char
Now we can use every ra0, ra1, ra2, ra3 same time by one VoCore2. 🙂
And we can setting network, firewall to use them for guest, nas etc…
PS: it support up to 16 ssids, you need to modify its setting in the same file.
Have fun!
VoCore2: Port mt7628.ko to LuCI 8
Install LuCI to the firmware, get some errors:
Tue May 15 00:07:30 2018 daemon.notice netifd: Interface 'wan' has link connectivity Tue May 15 00:07:30 2018 daemon.notice netifd: radio0 (844): uci: Parse error (too many arguments) at line 24, byte 24 Tue May 15 00:07:30 2018 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)
Tue May 15 00:11:10 2018 daemon.err uhttpd[794]: luci: accepted login on / for root from 192.168.61.231 Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/wwan'. Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: The called action terminated with an exception: Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'. Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'. Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'. Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'. Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'. Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value) Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: stack traceback: Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: [C]: in function 'assert' Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch' Tue May 15 00:11:23 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:127: in function Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/wwan'. Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: The called action terminated with an exception: Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'. Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'. Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'. Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'. Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'. Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value) Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: stack traceback: Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: [C]: in function 'assert' Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch' Tue May 15 00:12:19 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:127: in function Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/lan'. Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: The called action terminated with an exception: Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'. Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'. Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'. Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'. Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'. Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value) Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: stack traceback: Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: [C]: in function 'assert' Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch' Tue May 15 00:12:28 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:127: in function Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute arcombine dispatcher target for entry '/admin/network/network/lan'. Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: The called action terminated with an exception: Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'. Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/nsection'. Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/ucisection'. Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tabcontainer'. Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/network_ifacelist'. Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: A runtime error occured: /usr/lib/lua/luci/model/network.lua:1277: bad argument #4 to '?' (no value) Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: stack traceback: Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: [C]: in function 'assert' Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch' Tue May 15 00:19:48 2018 daemon.err uhttpd[794]: /usr/lib/lua/luci/dispatcher.lua:127: in function Tue May 15 00:38:37 2018 daemon.info dnsmasq-dhcp[1152]: DHCPREQUEST(br-lan) 192.168.61.231 78:4f:43:5b:75:57 Tue May 15 00:38:37 2018 daemon.info dnsmasq-dhcp[1152]: DHCPACK(br-lan) 192.168.61.231 78:4f:43:5b:75:57 Vongers-MBP-2 Tue May 15 00:38:37 2018 daemon.warn odhcpd[705]: DHCPV6 SOLICIT IA_NA from 00010001217b622f784f435b7557 on br-lan: ok fd2d:f637:12aa::4e9/128 Tue May 15 00:38:38 2018 daemon.warn odhcpd[705]: DHCPV6 REQUEST IA_NA from 00010001217b622f784f435b7557 on br-lan: ok fd2d:f637:12aa::4e9/128
I did not install iwinfo, so that should be one of the problem.
LuCI netdev interface can not be edit, that should be something missed.
VoCore2: Setup OpenWrt in MacOS 10.13
Just copy from openwrt official site.
I used to use port but brew looks better now.
First, install brew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It is broken when I install it, need to set privilege for some folders, you can call “brew doctor” to get instruction then fix it or search google 🙂
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep wget quilt xz gnu-time
note: in my macbook, I find getopt do not support –long. Looks like default it will find the getopt from MacOS (/usr/bin) but not the one from brew.
add this line to your ~/.profile, so system will search and use gnu-getopt first.(this path will be different if version of getopt changed)
export PATH="/usr/local/Cellar/gnu-getopt/1.1.6/bin:$PATH"
Then make a virtual disk by disk-utils, must be case sensitive disk, size around 20GB.
Clone openwrt latest version from github to the new disk.
git clone https://github.com/openwrt/openwrt.git
Then make menuconfig, everything will work.
If you want install mt7628.ko into the firmware, follow the tutorial at https://github.com/vonger/vocore2
VoCore2: Port mt7628.ko to LuCI 7
I find VoCore2 led is not working with new driver mt7628,ko, it is because in /etc/config/system, led is set to “wlan0” which is used by mt76 drivers.
So make a simple patch to fix it.
diff -Naur a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -443,10 +443,10 @@ set_wifi_led "vocore:green:status" ;; vocore2) - set_wifi_led "$boardname:fuchsia:status" + set_wifi_led "$boardname:fuchsia:status" "ra0" ;; vocore2lite) - set_wifi_led "$boardname:green:status" + set_wifi_led "$boardname:green:status" "ra0" ;; w502u) set_usb_led "$boardname:blue:usb"
Note: new version VoCore2 I plan to use red led, one reason is red more like heart than fuchsia, so when we transfer data, it is like its heartbeat, this is my VoCore2 Ultimate first design.
Another reason…fuchsia led is very shortage, every time it is hard to get (looks like not many people use it) 🙂
VoCore2: Port mt7628.ko to LuCI 6
I think it is working now 🙂
1. copy /etc/config/wireless from current vocore2 firmware to same folder.
2. copy /lib/netifd/wireless/ralink.sh from current vocore2 firmware to same folder.
3. chmod +x /lib/netifd/wireless/ralink.sh
Then reboot, at least ap mode is working.
Still some parameters and sta mode are not working, but these bugs should be easy to fix 🙂
OK, next time I can make a patch and put to github.
VoCore2: Port mt7628.ko to LuCI 5
Back to the old firmware based on OpenWrt CC. So only file related is /lib/netifd/wireless/ralink.sh
#!/bin/sh . /lib/netifd/netifd-wireless.sh init_wireless_driver "$@" maclist="" force_channel="" drv_ralink_init_device_config() { config_add_string country variant log_level short_preamble config_add_boolean noscan config_add_int channel } drv_ralink_init_iface_config() { config_add_string 'auth_server:host' config_add_string auth_secret config_add_int 'auth_port:port' config_add_string ifname apname mode ssid encryption key key1 key2 key3 key4 wps_pushbutton macfilter led config_add_boolean hidden isolate config_add_array 'maclist:list(macaddr)' } drv_ralink_cleanup() { logger drv_ralink_cleanup } ralink_setup_ap(){ local name="$1" local eap=0 json_select config json_get_vars mode ifname ssid encryption key key1 key2 key3 key4 wps_pushbutton server port hidden isolate macfilter json_get_values maclist maclist ifconfig $ifname up [ -z "$force_channel" ] || iwpriv $ifname set Channel=$force_channel [ "$isolate" = 1 ] || isolate=0 iwpriv $ifname set NoForwarding=$isolate iwpriv $ifname set NoForwardingBTNBSSID=$isolate iwpriv $ifname set NoForwardingMBCast=$isolate [ "$hidden" = 1 ] || hidden=0 iwpriv $ifname set HideSSID=$hidden wsc_methods=0 wsc_mode=0 case "$encryption" in psk*|mixed*) local enc="WPA2PSK" case "$encryption" in psk | psk+*) enc=WPAPSK;; psk2 | psk2*) enc=WPA2PSK;; mixed*) enc=WPAPSKWPA2PSK;; wpa | wpa+*) eap=1; enc=WPA;; wpa2*) eap=1; enc=WPA2;; esac local crypto="AES" case "$encryption" in *tkip+aes*) crypto=TKIPAES;; *tkip*) crypto=TKIP;; esac [ "$eap" = "1" ] && { iwpriv $ifname set RADIUS_Server=$server iwpriv $ifname set RADIUS_Port=$port iwpriv $ifname set RADIUS_Key=$key iwpriv $ifname set own_ip_addr=192.168.1.1 iwpriv $ifname set IEEE8021X=0 iwpriv $ifname set EAPifname=eth0.2 iwpriv $ifname set PreAuthIfname=br-lan } iwpriv $ifname set AuthMode=$enc iwpriv $ifname set EncrypType=$crypto iwpriv $ifname set IEEE8021X=0 iwpriv $ifname set "SSID=${ssid}" [ "$eap" = "1" ] || iwpriv $ifname set "WPAPSK=${key}" iwpriv $ifname set DefaultKeyID=2 iwpriv $ifname set "SSID=${ssid}" if [ "$wps_pushbutton" == "1" ]; then wsc_methods=128 wsc_mode=7 fi ;; wep) iwpriv $ifname set AuthMode=WEPAUTO iwpriv $ifname set EncrypType=WEP iwpriv $ifname set IEEE8021X=0 for idx in 1 2 3 4; do json_get_var keyn key${idx} [ -n "$keyn" ] && iwpriv $ifname set "Key${idx}=${keyn}" done iwpriv $ifname set DefaultKeyID=${key} iwpriv $ifname set "SSID=${ssid}" ;; none) iwpriv $ifname set "SSID=${ssid}" ;; esac iwpriv $ifname set WscConfMode=$wsc_mode iwpriv $ifname set WscConfStatus=2 iwpriv $ifname set WscMode=2 iwpriv $ifname set ACLClearAll=1 [ -n "$maclist" ] && { for m in ${maclist}; do logger iwpriv $ifname set ACLAddEntry="$m" iwpriv $ifname set ACLAddEntry="$m" done } case "$macfilter" in allow) iwpriv $ifname set AccessPolicy=1 ;; deny) iwpriv $ifname set AccessPolicy=2 ;; *) iwpriv $ifname set AccessPolicy=0 ;; esac json_select .. wireless_add_vif "$name" "$ifname" } ralink_setup_sta(){ local name="$1" json_select config json_get_vars mode apname ifname ssid encryption key key1 key2 key3 key4 wps_pushbutton disabled led [ "$disabled" = "1" ] && return key= case "$encryption" in psk*|mixed*) json_get_vars key;; wep) json_get_var key key1;; esac json_select .. /sbin/ap_client "ra0" "$ifname" "${ssid}" "${key}" "${led}" sleep 1 wireless_add_process "$(cat /tmp/apcli-${ifname}.pid)" /sbin/ap_client ra0 "$ifname" "${ssid}" "${key}" "${led}" wireless_add_vif "$name" "$ifname" } drv_ralink_setup() { local ifname="$1" local bcn_active=0 wmode=9 VHT=0 VHT_SGI=0 HT=0 EXTCHA=0 sta_disabled="$(uci get wireless.sta.disabled)" [ "${sta_disabled}" = "1" ] && bcn_active=1 json_select config json_get_vars variant country channel htmode log_level short_preamble noscan:0 json_select .. [ "$short_preamble" = 1 ] || short_preamble=0 case ${htmode:-none} in HT20) wmode=10 HT=0 ;; HT40) wmode=10 HT=1 EXTCHA=1 ;; VHT20) wmode=15 HT=0 VHT=0 VHT_SGI=1 ;; VHT40) wmode=15 HT=1 VHT=0 VHT_SGI=1 EXTCHA=1 ;; VHT80) wmode=15 HT=1 VHT=1 VHT_SGI=1 EXTCHA=1 ;; *) case $hwmode in a) wmode=2;; g) wmode=3;; esac ;; esac if [ "$auto_channel" -gt 0 ]; then force_channel="" channel=0 auto_channel=3 else force_channel=$channel auto_channel=0 fi coex=1 [ "$noscan" -gt 0 ] && coex=0 cat /etc/Wireless/${variant}_tpl.dat > /tmp/${variant}.dat cat >> /tmp/${variant}.dat << EOF Beacon=${bcn_active} BssidNum=4 HT_BW=${HT:-0} HT_EXTCHA=${EXTCHA:-0} CountryCode=${country} WirelessMode=${wmode:-9} Channel=${channel:-8} AutoChannelSelect=$auto_channel Debug=${log_level:-3} SSID1=${ssid:-OpenWrt} HT_BSSCoexistence=$coex WscConfMethods=680 EOF for_each_interface "ap" ralink_setup_ap for_each_interface "sta" ralink_setup_sta wireless_set_up LED="$(uci get wireless.sta.led)" sta_disabled="$(uci get wireless.sta.disabled)" [ "${sta_disabled}" = "1" -a -n "${LED}" -a -f /sys/class/leds/${LED}/trigger ] && ap_client ${LED} set } ralink_teardown() { json_select config json_get_vars ifname json_select .. ifconfig $ifname down LED="$(uci get wireless.sta.led)" [ -n "${LED}" -a -f /sys/class/leds/${LED}/trigger ] && ap_client ${LED} clear } drv_ralink_teardown() { wireless_process_kill_all for_each_interface "ap sta" ralink_teardown } add_driver ralink
This code is using iwpriv setting up the driver, so it should be directly working.
drv_ralink_setup get country, channel, htmode, and setting this in driver.
then enable every ap interface and sta interface by ralink_setup_ap/ralink_setup_sta.
ralink_setup_ap get "mode ifname ssid encryption key key1 key2 key3 key4 wps_pushbutton server port hidden isolate macfilter" and setting up those value in mt7628.ko by iwpriv directly.
ralink_setup_sta is the ap+sta mode, it will call /sbin/ap_client to setup the ap+sta mode.
Everything is clear, I can make my own ralink.sh based on this beautiful script 🙂
VoCore Screen: Update with Raspberry Pi
I have updated the screen SDK and ADD RASPBERRY PI support, it is in SDK named lib/raspi/libvodisp.so
Like all other linux system, raspberry pi must use root to send data through USB…my raspberryPi is very slow(maybe it is because its index is zero, power consume is pretty high…1 watt+ 🙂
Currently SDK already has base function to show something on the screen, but still left a lot to do…
1. More Color Mode Support: 8bit colors, 16bit colors
enable this to support more games with less CPU, such as NEOGEO/FC, etc…
2. Linux Kernel Driver(fbcon)
enable this to enable console data directly output to screen and a real frame buffer function.
3. Rotated/Mirror Support
hardware support for fast convert speed.
4. RGB/BGR Pixel Order
5. Backlight PWM Control
6. Touch Screen
…
Hopefully once I finish step 1 and 2 in a few weeks, I can open source the kernel code. Currently this core firmware code is write by C and ASM and it is very ugly(or tricky) anyway I do not plan to open source it. But I will provide blob(vodisp.ko) with detailed documentation and interfaces later.
Actually the interface of vodisp.ko is pretty simple, just two, one is used to setting up the chip — I call it “connect” or “open”, another is used to send RGB or BGR pixel data from USB to screen, I call it “write”.
Emm, I guess we can use standard C interface for driver: open/close/write/ioctl, ioctl is good enough do the setting up job 🙂