Hello Felix, Dnia 2012-03-05, pon o godzinie 21:36 +0100, Felix Fietkau pisze: > On 2012-03-05 7:20 PM, Łukasz Kwestarz wrote: > > Patch probably adds also support for 802.11a mode (not tested), fixes some > > issues in iwinfo lib and not working WIFI activity led on WRT150N v1.1. > > Please review it carefully, it was my first time with ash and I haven't > > been using C for a long time. > > > > Patch for LuCI will follow. > > > > Signed-off-by: Łukasz Kwestarz <kwest...@me.com> > > > > Index: package/iwinfo/src/iwinfo_wl.c > > =================================================================== > > --- package/iwinfo/src/iwinfo_wl.c (wersja 30798) > > +++ package/iwinfo/src/iwinfo_wl.c (kopia robocza) > > @@ -571,7 +571,52 @@ > > > > int wl_get_hwmodelist(const char *ifname, int *buf) > > { > > - return wext_get_hwmodelist(ifname, buf); > > + int phytype; > > + if (!wl_ioctl(ifname, WLC_GET_PHYTYPE, &phytype, sizeof(phytype))) > > + { > > + if(phytype == PHY_TYPE_N) > > + { > > + *buf |= IWINFO_80211_N; > > + int bandlist[WLC_BAND_ALL]; > > + if (!wl_ioctl(ifname, WLC_GET_BANDLIST, bandlist, > > sizeof(bandlist))) > > + { > > + for (int i = 1; i <= bandlist[0]; i++) > > + { > > + if(bandlist[i] == WLC_BAND_5G) > > + { > > + *buf |= IWINFO_80211_A; > > + } > > + else > > + { > > + *buf |= IWINFO_80211_B; > > + *buf |= IWINFO_80211_G; > > + } > > + } > > + return 0; > > + } > > + } > > + else > > + { > > + char phylist[4]; > > + if (!wl_ioctl(ifname, WLC_GET_PHYLIST, phylist, > > sizeof(phylist))) > > + { > > + for(int i = 0; phylist[i]; i++) > > + { > > + if(phylist[i] == 'a') > > + { > > + *buf |= IWINFO_80211_A; > > + } > > + else > > + { > > + *buf |= IWINFO_80211_B; > > + *buf |= IWINFO_80211_G; > > + } > > + } > > + return 0; > > + } > > + } > > + } > > + return -1; > The indentation level there is a bit excessive, could you restructure > the code a bit to make it more readable? > Replace things like > if (!wl_ioctl(ifname, WLC_GET_PHYTYPE, &phytype, sizeof(phytype))) { > <code...> > } > > with: > if (wl_ioctl(ifname, WLC_GET_PHYTYPE, &phytype, sizeof(phytype))) > return -1; > <code...> Sure can change that.
> > > Index: package/broadcom-wl/files/lib/wifi/broadcom.sh > > =================================================================== > > --- package/broadcom-wl/files/lib/wifi/broadcom.sh (wersja 30798) > > +++ package/broadcom-wl/files/lib/wifi/broadcom.sh (kopia robocza) > > @@ -130,11 +130,19 @@ > > config_get txpower "$device" txpower > > config_get frag "$device" frag > > config_get rts "$device" rts > > + config_get band "$device" band > > config_get hwmode "$device" hwmode > > local vif_pre_up vif_post_up vif_do_up vif_txpower > > local doth=0 > > local wmm=1 > > - > > + local gmode=1 > > + local nmode=0 > > + local nreqd=0 > > + local leddc=$(($(wlc leddc))) > > + if [ "$leddc" -eq 65535 ]; then > > + leddc=6553600; > > + fi > Are you sure this is generic enough to be applied to all devices? > If you asking about led, yes I'm pretty sure, saw similar fixes in dd-wrt and tomato. No big risk it affects only led :) > > @@ -161,13 +169,25 @@ > > ;; > > esac > > > > + case "$band" in > > + a) band=1;; > > + b) band=2;; > > + esac > > + > > case "$hwmode" in > > - *b) hwmode=0;; > > - *bg) hwmode=1;; > > - *g) hwmode=2;; > > - *gst) hwmode=4;; > > - *lrs) hwmode=5;; > > - *) hwmode=1;; > > + *a) ;; > > + *b) gmode=0;; > > + *bg) ;; > > + *g) gmode=2;; > > + *gst) gmode=4;; > > + *lrs) gmode=5;; > > + *n) > > + nreqd=1 > > + nmode=1 > > + ;; > > + *) > > + nmode=-1 > > + ;; > > esac > > > > for vif in $vifs; do > What's lrs? And why gst with turbo - what's that for? > And why no support for 11ng/11na similar to how it's done in mac80211? > Those two settings were here before, so I didn't paid much attention to them, but you can find them in wl gmode man, also OpenWRT wiki contains few words about. 11ng/11na is confusing for me, there is no something like 11ng/11na outside OpenWrt world (or I'm not aware of :)), there is 11n on 5 ghz band and 11n on 2.4 ghz band so in my opinion band selection is reasonable and means much more for end user. > > @@ -322,7 +342,11 @@ > > wlc ifname "$device" stdin <<EOF > > $ifdown > > > > -gmode ${hwmode:-1} > > +leddc ${leddc} > > +band ${band:-0} > > +gmode ${gmode} > > +nmode ${nmode} > > +nreqd ${nreqd} > > apsta $apsta > > ap $ap > > ${mssid:+mssid $mssid} > > > @@ -386,6 +410,7 @@ > > option mode ap > > option ssid OpenWrt${i#0} > > option encryption none > > + option wmm 1 > Not necessary, the wmm default was already changed and normally you > should not have to turn it off anyway. > Correct but I think it should be marked as enabled in LuCI or other UI interfaces. > - Felix Thanks for quick response and comments:) Łukasz Kwestarz _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel